You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gary Denslow <ga...@yahoo.com> on 2004/01/07 23:10:36 UTC

Re: [mp1] signal handler for USR2 in startup.pl doesn't work

this is working for me.  thanks for the suggestion!
 
use POSIX;
 
my $sigset = POSIX::SigSet->new();
my $action = POSIX::SigAction->new(
    'sigUSR2_handler',
    $sigset,
    &POSIX::SA_NODEFER,
);
 
POSIX::sigaction(&POSIX::SIGUSR2, $action);

sub sigUSR2_handler {
    warn "got SIGUSR2\n";
}

Re: [mp1] signal handler for USR2 in startup.pl doesn't work

Posted by Torsten Foertsch <to...@gmx.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 07 January 2004 23:10, Gary Denslow wrote:
> this is working for me.  thanks for the suggestion!
>
> use POSIX;
>
> my $sigset = POSIX::SigSet->new();
> my $action = POSIX::SigAction->new(
>     'sigUSR2_handler',
>     $sigset,
>     &POSIX::SA_NODEFER,
> );
>
> POSIX::sigaction(&POSIX::SIGUSR2, $action);
>
> sub sigUSR2_handler {
>     warn "got SIGUSR2\n";
> }

It doesn't work for me. I the weak point is the symbolic reference to your sig 
handler. I'd prefer hard a reference:

- --------------------------------------------------------
use POSIX;

my $sigset = POSIX::SigSet->new();
my $action = POSIX::SigAction->new(
    sub {
      warn "got SIGUSR2\n";
    },
    $sigset,
    &POSIX::SA_NODEFER,
);
 
POSIX::sigaction(&POSIX::SIGUSR2, $action);
- --------------------------------------------------------

but if you want to use a symbolic reference explicitly mention the package:

- --------------------------------------------------------
use POSIX;

my $sigset = POSIX::SigSet->new();
my $action = POSIX::SigAction->new(
    'X::sighnd',
    $sigset,
    &POSIX::SA_NODEFER,
);

sub X::sighnd {
  warn "got SIGUSR2\n";
}
 
POSIX::sigaction(&POSIX::SIGUSR2, $action);
- --------------------------------------------------------

Torsten
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE//RYqwicyCTir8T4RAnREAJ9KBNc8dduIsxXZVSZJATNtshLn2ACffnqr
maIBXdsH1skwYEBBpE+WE/4=
=rH3W
-----END PGP SIGNATURE-----

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html