Mega Code Archive

 
Categories / Ruby / Threads
 

Run this block in a new thread

t = Thread.new do       # Run this block in a new thread   File.read("data.txt") # Read a file in the background end                     # File contents available as thread value