Skip to content

Instantly share code, notes, and snippets.

@qmx
Created October 7, 2011 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qmx/1269466 to your computer and use it in GitHub Desktop.
Save qmx/1269466 to your computer and use it in GitHub Desktop.
threads = []
5.times do |i|
threads << Thread.new do
puts "starting thread #{i}"
sleep 2
puts "ending thread #{i}"
end
end
threads.each do |thread|
thread.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment