Basic Ruby Threads in Action : Ruby Threads « Threads « Ruby
- Ruby
- Threads
- Ruby Threads
Basic Ruby Threads in Action
threads = []
10.times do
thread = Thread.new do
10.times { |i| print i; $stdout.flush; sleep rand(2) }
end
threads << thread
end
threads.each { |thread| thread.join }
Related examples in the same category