Re: playing nicely with signal handlers

[email protected] (Joshua N Pritikin) Tue, 20 Apr 2004 08:48:01 +0530
Newsgroups perl.loop
Message-ID <[email protected]>
On Mon, Apr 19, 2004 at 09:18:08PM +0100, Zefram wrote:
> Before I started using Event, I had a couple of signal handlers that,
> as part of their work, locally modified the handling of their signal.
> The interesting case is with SIGTSTP: after doing some application
> cleanup, it would temporarily reset SIGTSTP to default handling and
> unblock it and then deliver itself a SIGTSTP.  The point of this is
> that the behaviour looks, from the user's point of view, just like an
> ordinary ^Z suspension, but the application cleanup gets done along
> the way.  After the program is restarted, the signal handler restores
> the catching of SIGTSTP and does more bookkeeping before returning.

Have you tried simply calling ->stop() on the SIGTSTP signal watcher?
I believe that will change the handler back to SIG_DFL.

-- 
A new cognitive theory of emotion, http://openheartlogic.org
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAhJZpqcqnlKSmC70RAmhiAJ9l+y3PfDV3bCTH4E2C9zTKBjfL8gCgmo4b
kuDFxYtlqCaIExH2gdtbDv4=
=Ldlw
-----END PGP SIGNATURE-----