in reply to Exiting a script with an 'infinitely looping' thread
Ctrl-C doesn't exit cleanly, so despite the new warning, you're no worse off than you were before.
$ perl -le'DESTROY { print "Destroyed" } my $x = bless {}; print "slee +ping"; sleep 5;' sleeping Destroyed $ perl -le'DESTROY { print "Destroyed" } my $x = bless {}; print "slee +ping"; sleep 5;' sleeping ^C $
What you could do is hook into $SIG{TERM}, $SIG{INT}, etc. The signal handler would send some kind of request to the threads asking them to exit, then join with the threads.
The thread is also sitting in a can_read() call and so wouldn't see the shared variable anyways.
Not true. You could set a timeout on the can_read so you can poll a shared variable. Another option would be to create a communication pipe or socket and add the it to the select object.
|
|---|