Join a thread after sleeping : join « Threads « Ruby






Join a thread after sleeping


meaning_of_life = Thread.new do
  puts "The answer is..."
  sleep 10
  puts 42
end

sleep 9
meaning_of_life.join

 








Related examples in the same category

1.each thread is given only one second to execute:
2.Join threads
3.Multithreaded Applications in Ruby
4.Join two threads
5.rescue the exception at the time the threads are joined.