Join threads : join « Threads « Ruby

Join threads

10.times { { 10.times { |i| print i; $stdout.flush; sleep rand(2) } } }
Thread.list.each { |thread| thread.join }


Related examples in the same category

1.each thread is given only one second to execute:
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