fork combine daemon
a = 12
fork do
Process.daemon(true,true)
sleep 10
puts Process.ppid
puts a
puts "lalalala"
end
fork do
Process.daemon(true,true)
sleep 5
puts "gagagaga"
end
puts Process.pid
puts "quit"
require 'spawnling'
a = 12
Spawnling.new do
# Process.daemon(true,true)
sleep 10
puts Process.ppid
puts a
puts "lalalala"
end
Spawnling.new do
# Process.daemon(true,true)
sleep 5
puts "gagagaga"
end
puts Process.pid
puts "quit"
a = 12
job1 = fork do
# Process.daemon(true,true)
sleep 10
puts Process.ppid
puts a
puts "lalalala"
end
job2 = fork do
# Process.daemon(true,true)
sleep 5
puts "gagagaga"
end
Process.detach(job1)
Process.detach(job2)
puts Process.pid
puts "quit"