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

Re^3: Handling SIG INT multiple times

by sundialsvc4 (Abbot)
on Oct 01, 2015 at 16: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 04: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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2020-10-25 05:46 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.