fork with block : fork « Threads « Ruby






fork with block


fork do 
    puts "In child, pid = #$$" 
    exit 99 
end 
pid = Process.wait 
puts "Child terminated, pid = #{pid}, status = #{$?.exitstatus}" 

 








Related examples in the same category

1.fork is a method provided by the Kernel module that creates a fork of the current process.
2.fork a number of listening processes to increase the maximum number of connections
3.Fork a child process
4.Is it a parent process or a child process
5.Environment in Child thread