each thread is given only one second to execute: : join « Threads « Ruby





each thread is given only one second to execute:


threads.each do |thread|
  puts "Thread #{thread.object_id} didn't finish within 1s" unless thread.join(1)
end

 

Related examples in the same category

1.Join threads
2.Multithreaded Applications in Ruby
3.Join two threads
4.rescue the exception at the time the threads are joined.
5.Join a thread after sleeping