http://www.perlmonks.org?node_id=1021082


in reply to Perl 5.8.8 threads, clean exit

Pardon me for resurrecting a slightly-old thread here, but I do have a question that’s just bugging me.   Even though the particular code-sample given here does not actually print a message when it sends a KILL (phony-)signal to the threads, the OP says that the signal never gets sent to the second thread.

The example does seem to pretty closely match the one given in the PerlDoc, which at least implies that the signaling to multiple threads ought to be successful.   The example, in other words, appears to be pretty much “by the book.”

In the “Edit,” portion, which I am just now reading, the OP says that (in another Perl version) the loop that sends the signals blocks after sending the first signal.   Is this presumably the cause of the previously described behavior, “thread #2 never gets a signal?”

I understand that these are “not real signals,” and it’s easy enough to glom why not.   But does the implementation actually block the sender?!   Is that true of all the (all equally-phony) signal types?

How might the OP have salvaged this situation, in your (specifically, your...) opinion?   Is there an alternate way of doing a similar thing (“interrupting a child thread, more or less”) that would have been successful and reliable across versions?   Or is it simply, “irreconcilably broken?”