Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Print inside SIGNALS

by sundialsvc4 (Abbot)
on Jul 17, 2018 at 19:49 UTC ( #1218689=note: print w/replies, xml ) Need Help??


in reply to Print inside SIGNALS

Categorically speaking, I suggest that such timeout-handlers should only set a global flag that is tested by the various main-program loops.   When the flag becomes raised, the programs break out of their loops.   I consider it hazardous to attempt to do actual cleanup processing closing file-handles and so forth within such a handler because you really don’t know the exact instance at which the signal arrived.   Programs that randomly crash when interrupted ... sometimes, but never when you are trying to debug them ... are the usual symptom of this kind of design.   If you follow my suggestion, you know that the program will always stop “at a good stopping place,” leaving the internal state of the system always-good.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1218689]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2019-12-06 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (157 votes). Check out past polls.

    Notices?