Skip to content

Instantly share code, notes, and snippets.

@cwgem
Created September 24, 2011 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cwgem/1239892 to your computer and use it in GitHub Desktop.
Save cwgem/1239892 to your computer and use it in GitHub Desktop.
Simple Fork Example
# Parent process
3.times do
fork do
# child process logic here
trap('INT') { exit }
loop { puts "Hello from #$$"; sleep 3 }
# end child process logic
end
end
# Parent process logic continues
trap('INT') { exit }
Process.waitall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment