Last active
December 18, 2015 01:29
-
-
Save mholubowski/5704168 to your computer and use it in GitHub Desktop.
What goes down here?
Why doesn't each thread end in succession?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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