Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Why this daemon can only receive the HUP signal no more than one time?

by lifeboat (Initiate)
on Apr 05, 2017 at 09:34 UTC ( [id://1187083]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Why this daemon can only receive the HUP signal no more than one time?
in thread Why this daemon can only receive the HUP signal no more than one time?

Based on Re: Can't catch signals after an exec?, change your code
$SIG{HUP} = \&doSigHup;
to:
use POSIX (); $sigset=POSIX::SigSet->new(); $action=POSIX::SigAction->new('doSigHup',$sigset,&POSIX::SA_NODEFER); POSIX::sigaction(&POSIX::SIGHUP, $action);

Replies are listed 'Best First'.
Re^4: Why this daemon can only receive the HUP signal no more than one time?
by Anonymous Monk on Apr 05, 2017 at 17:38 UTC

    $action=POSIX::SigAction->new('doSigHup',$sigset,&POSIX::SA_NODEFER);
    Note that you are setting up an "unsafe" signal, as opposed to Safe Signal that original poster was using. Furthermore, the use of SA_NODEFER to avoid changes to sigprocmask has the unfortunate side-effect of making your handler re-interruptable from within its own signal handler.

    Altogether, a particularly nasty concoction that may eventually result in data corruption. I'd rather advise to just clear the blocked signal at program (re)start, after the handler is assigned of course.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2024-04-18 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found