Skip to content

Instantly share code, notes, and snippets.

@bxt
Last active May 14, 2017 00:02
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 bxt/d2504617c6dfc8dd201b11b9d9b58886 to your computer and use it in GitHub Desktop.
Save bxt/d2504617c6dfc8dd201b11b9d9b58886 to your computer and use it in GitHub Desktop.
Fork test in Crystal lang
puts "Starting..."
forks = 10.times.map do |i|
fork do
puts "In fork #{i}"
sleep(i)
puts "End fork #{i}"
end
end.to_a
puts "Forked everything."
forks.each do |f|
f.wait unless f.terminated?
end
puts "Done waiting."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment