Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (20 sloc) 580 Bytes
fm: |-
require 'rubygems'
require 'fork_manager'
puts "PARENT PID #{}"
fm =
# loop 20 times, each time fork a child and print that child's pid
# sleep for 3 seconds so that there is time to see how processes are limited.
statuses = fm.manage {
20.times do
child = fm.fork {
sleep 3
puts " CHILD PID #{child}"
# dump the status info from Process.waitall
puts "Final process statuses"
statuses.each {|x| puts x}
puts "Finished"