On onsdag, jan 22, 2003, at 00:19 Europe/Stockholm, Joshua Hoblitt wrote:
Arthur,
I am not sure there is a big issue with signals, but there is currently no code in the signal handling that knows about threads, or tries to block signals depending on threads, the safe signal facility is just a deferred interruption of the signal to perl code when it is safe to do so.
Please excuse my ignorance of the Perl internals but I was wondering if you could explain exactly what the issue with ithreads and signals is.
On the two platforms I'm most familiar with, Linux and Solaris, this would actually work as long as it was running in the "original" thread. After some testing to seems that all signals are delivered to the "original" thread regardless of where it was generated. I know that with pthreads signals should only be delivered to thread that requested the interrupt. Are the ithread issues caused by the new "safe" signal facility?In other words something similar to this:eval { $| = 1; local $SIG{ALRM} = sub { die 'timeout!' }; alarm($timeoutsec); # DO SOMETHING HERE $status = do_something(); alarm(0); }; if(!$status) { # Timed out # HANDLE THE TIMEOUT PROPERLY }
Cheers,
I have been reluctant to touch signals because they are even by the pthread spec not clear what they should do, but I am pretty sure that on linux which has a different PID for every thread it should work flawlessly ;-)
Arthur
