You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a complex case where I want to use systemu to run programs but the thread that happens in might sometimes die.
here's a simple bit of code that demonstrates:
Signal.trap("INT") do
puts "Int!"
end
Process.kill(2, $$)
s = Thread.new {
systemu("sleep 10") do |pid|
Process.waitpid(pid)
end
}
sleep 4
s.terminate
puts "terminated thread..."
sleep 10
3.times {
Process.kill(2, $$)
puts "self killed..."
sleep 0.5
}
Process.kill(9, $$)
If you run this you'll see the first Int gets received, it then starts a thread that sleeps for 10 seconds - but 4 seconds into the 10 the thread gets killed.
The sleep continues till its past its 10 seconds - thats great and what I want - but after that the INT signal is ignored.
The calling thread wont exit often but its possible something can go wrong and so loosing INT is a problem. In cases where the thread doesn't exit then INT is still fine
The text was updated successfully, but these errors were encountered:
I have a complex case where I want to use systemu to run programs but the thread that happens in might sometimes die.
here's a simple bit of code that demonstrates:
If you run this you'll see the first Int gets received, it then starts a thread that sleeps for 10 seconds - but 4 seconds into the 10 the thread gets killed.
The sleep continues till its past its 10 seconds - thats great and what I want - but after that the INT signal is ignored.
The calling thread wont exit often but its possible something can go wrong and so loosing INT is a problem. In cases where the thread doesn't exit then INT is still fine
The text was updated successfully, but these errors were encountered: