A
Ara.T.Howard
i'd like a way to fork a child, while will have a heartbeat thread running
pinging the parent, partial example:
class Slave
def initialize
unless fork
Thread.abort_on_exception = true
Thread::new do
loop do
Process::kill 0, Process:pid
sleep 42
end
end
yield
end
end
end
slave =
Slave::new do
loop do
FileUtils::touch 'sentinal'
sleep 42
end
end
in case it isn't clear, this slave dies if it's parent dies. in the real code
there is a method to kill the slave, the slave is detached, etc.
the thing is, i want the slave to execute 'exit!' not 'exit' on thread error
such that exit handlers do not get run.
any thoughts on how to do this?
perhaps redefining Kernel#exit in the slave?
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| When you do something, you should burn yourself completely, like a good
| bonfire, leaving no trace of yourself. --Shunryu Suzuki
===============================================================================
pinging the parent, partial example:
class Slave
def initialize
unless fork
Thread.abort_on_exception = true
Thread::new do
loop do
Process::kill 0, Process:pid
sleep 42
end
end
yield
end
end
end
slave =
Slave::new do
loop do
FileUtils::touch 'sentinal'
sleep 42
end
end
in case it isn't clear, this slave dies if it's parent dies. in the real code
there is a method to kill the slave, the slave is detached, etc.
the thing is, i want the slave to execute 'exit!' not 'exit' on thread error
such that exit handlers do not get run.
any thoughts on how to do this?
perhaps redefining Kernel#exit in the slave?
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| When you do something, you should burn yourself completely, like a good
| bonfire, leaving no trace of yourself. --Shunryu Suzuki
===============================================================================