Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

sleep and waking on signal handlers

by TedYoung (Deacon)
on Aug 29, 2007 at 16:07 UTC ( [id://635835]=perlquestion: print w/replies, xml ) Need Help??

TedYoung has asked for the wisdom of the Perl Monks concerning the following question:

I have a small script that goes to sleep for several minutes. I trap SIGINT so that I can do a graceful shutdown of the script. The problem is, if a SIGINT is sent to the script during sleep, the script won't see it until it wakes back up.

Is there a way to wake up the script when a signal is sent to it?

Update: Yes, I should have confessed I was on windows. I rarely use signals, and I rarely use windows. I forgot that it isn't the best combination. Thanks!

Thanks,

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

Replies are listed 'Best First'.
Re: sleep and waking on signal handlers
by BrowserUk (Patriarch) on Aug 29, 2007 at 16:40 UTC
Re: sleep and waking on signal handlers
by ikegami (Patriarch) on Aug 29, 2007 at 16:09 UTC
    sleep is interrupted by signals.

      ...or are you on Windows, where signals are only partially emulated? You might have better luck with SetConsoleCtrlHandler.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://635835]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found