[Twisted-Python] InstallSignalHandlers question

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Feb 20 18:09:42 EST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Thursday, February 20, 2003, at 03:12 PM, Chris Skinner wrote:

> Hi,
>   I couldn't find any reference to methods/overrides I would need to
> implement in my Application. to actually do some processing on
> specific signals... is the flag in .run() just disabling some
> previous call to signal assigning a default handler?

Mucking with signal handlers directly is almost certainly the wrong way 
to do this :)

>   Primarily I'm looking to implement an in-process re-initialize,
> log-rotation and to catch the shutdown so I can terminate another
> process before exiting.

In the shutdown case, it sounds like you want to either override 
twisted.internet.protocol.Factory.startFactory or 
twisted.internet.app.ApplicationService.startService ... this is not 
really about signal handling, after all, because you want to shut down 
when Twisted shuts down.

In the re-init &c &c case, you can probably just catch SIGUSR1 (or 
whatever you want to re-initialize on) directly, since Twisted doesn't 
trap that itself.  However you may want to propose some defined 
semantics for future versions of Twisted, in case we ever want to 
implement this as part of the framework :-).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)

iD8DBQE+VWA6vVGR4uSOE2wRAgQFAJ9epoNdz4VWY0nl3rJPNz1I7xxx6wCfUetJ
+ssKp+8Olo3evQgySm7RdjU=
=RXdC
-----END PGP SIGNATURE-----





More information about the Twisted-Python mailing list