Sleep a thread : Ruby Threads « Threads « Ruby






Sleep a thread


t1 = Thread.new do
  puts "Hello"
  sleep 2
  raise "some exception"
  puts "Goodbye"
end

t2 = Thread.new { sleep 100 }

sleep 2
puts "The End"

 








Related examples in the same category

1.Basic Ruby Threads in Action
2.Run this block in a new thread
3.Get the value returned from a thread