Skip to content

Instantly share code, notes, and snippets.

@mholubowski
Last active December 18, 2015 01:29
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 mholubowski/5704168 to your computer and use it in GitHub Desktop.
Save mholubowski/5704168 to your computer and use it in GitHub Desktop.
What goes down here? Why doesn't each thread end in succession?
def print_every_3_seconds num
5.times do
puts "Thread #{num}"
sleep 3
end
puts "** DONE #{num} **"
end
(1..100).each do |num|
Thread.new do
print_every_3_seconds num
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment