Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Handling SIG INT multiple times

by sundialsvc4 (Abbot)
on Oct 01, 2015 at 12:24 UTC ( #1143584=note: print w/replies, xml ) Need Help??


in reply to Re^2: Handling SIG INT multiple times
in thread Handling SIG INT multiple times

Well now, strictly speaking, you could do this in the main thread, if the program never has anything else to do.   The main thread could be the one that contains the loops aforementioned.   For a daemon-program that does not interact with anyone or anything else, that might be just fine.

The main “take aways” are:   (1) the notion of a signal as a wakeup-call, and of not attempting to do anything substantial in them;   (2) the notion that signals are not one-to-one paired with work requests and might in some cases get dropped;   (3) the notion that the main loop might run a few extra times with nothing to do, provided that, thereby, it is assured never to “sleep through” the signal that is its appointed purpose in life.

If you use a thread, it will run truly-concurrently with the main, and all the usual shared-variable caveats apply.   Unlike, say, Ruby, these are “real” operating-system threads.   Fortunately, Perl’s implementation is (mostly ... *wink!*) friendly.

Replies are listed 'Best First'.
Re^4: Handling SIG INT multiple times
by Anonymous Monk on Oct 02, 2015 at 00:56 UTC
    oops.i +1d. i meant to click minus because i dont agree with this type of nonchalance in the monastery.
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1143584]
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: (6)
As of 2019-11-22 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (113 votes). Check out past polls.

    Notices?