[Twisted-Python] InstallSignalHandlers question

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

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 :-).
Version: GnuPG v1.2.1 (Darwin)


More information about the Twisted-Python mailing list