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
1. | Basic Ruby Threads in Action | ||
2. | Get the value returned from a thread | ||
3. | Sleep a thread |