in reply to Re^5: Exiting a script with an 'infinitely looping' thread
in thread Exiting a script with an 'infinitely looping' thread
Due to Perl "safe signals", sleep is an uninteruptable opcode
The docs and my observations disagree.
#!/usr/bin/perl $\ = "\n"; $SIG{INT} = sub { print "SIGINT" }; print time; sleep(); # Sleep forever print time;
1227543323 SIGINT 1227543325
Safe signals means that the handler is only called after sleep returns, but sleep returns as soon as a signal is received.
The behaviour differs in Windows, but then again, there are no signals in Windows.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Exiting a script with an 'infinitely looping' thread
by BrowserUk (Patriarch) on Nov 24, 2008 at 16:53 UTC | |
by ikegami (Patriarch) on Nov 24, 2008 at 17:18 UTC | |
by BrowserUk (Patriarch) on Nov 24, 2008 at 17:42 UTC | |
by ikegami (Patriarch) on Nov 24, 2008 at 18:01 UTC | |
by BrowserUk (Patriarch) on Nov 24, 2008 at 19:11 UTC | |
|