Skip to content

Instantly share code, notes, and snippets.

@m4rkw
Created September 9, 2015 15:53
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 m4rkw/fd06bd16c584632cf943 to your computer and use it in GitHub Desktop.
Save m4rkw/fd06bd16c584632cf943 to your computer and use it in GitHub Desktop.
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