Created
September 9, 2015 15:53
-
-
Save m4rkw/fd06bd16c584632cf943 to your computer and use it in GitHub Desktop.
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
threads = [] | |
for i in 0..1 | |
puts "parent: #{i}" | |
threads << Thread.new do | |
puts "child: #{i}" | |
end | |
end | |
threads.each(&:join) | |
output: | |
parent: 0 | |
parent: 1 | |
child: 1 | |
child: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment