Restoring signal handler when embedded.

[email protected] (Bill Moseley)
Newsgroups perl.xs
Message-ID <[email protected]>
When Perl is embedded with another application, like Apache and mod_perl,
can I catch a signal in Perl and then still run the initail signal handler
Apache set?

On a "graceful stop" the Apache parent process sends a USR1 signal to its
children when it wants them to shut down.  The handler sets flags telling
the process to finish.  In mod_perl I'd also like to catch this signal.

I can indeed setup a signal handler in Perl and catch the signal, but then
the Apache handler is not run -- which is what I'd expect.    I tried
looking at the third parameter to POSIX::sigaction, but Perl just returns
"DEFAULT" for the previous handler.  I also tried setting SA_RESETHAND with
the remote hope that it would reset back to the apache handler and I'd just
"re-throw" the signal via kill.  No luck there.

Is it possible in XS to capture the original handler and then either call it
directly on the signal or re-instate the Apache handler  and call "kill $sig
$$"?  And if so, can you point me to an XS example (or perhaps a better
approach)?

My goal is to alter a response from Apache when a graceful stop has been
requested.

Thanks,

-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.