Wakeup main thread : wakeup « Threads « Ruby






Wakeup main thread

alarm = Thread.new(self) { sleep(5); Thread.main.wakeup }
puts "sleep for 1000 seconds at #{Time.new}"
sleep(10000); puts "Woke up at #{Time.new}!"

 

Related examples in the same category

1.Wake up a thread