[Twisted-Python] Question about application exit handling

Jay Deiman jay at splitstreams.com
Thu Apr 2 16:27:59 EDT 2009

Jay Deiman wrote:
> First, I'm pretty new to the Twisted framework and I've spent a lot of 
> time poking through documentation and subsequently, I've managed to 
> figure out a lot of things on my own.
> Here is one issue I'm having right now.  I wrote an application to be 
> run under twistd and it works great, except for one problem.  When I try 
> to exit twistd, it hangs.  I know why this is, it's due to a 
> twisted.python.threadpool.ThreadPool that I've instantiated and use in 
> my code.  Now, here is the actual question.  Is there a 
> callback/signal/notifier of some sort that is triggered when an 
> application is closed?  I know twistd handles the SIGINT, SIGTERM, etc., 
> but is there some sort of notification that is sent to the current 
> running application that I can use for clean up?

Nevermind.  I initially misunderstood the startFactory() and 
stopFactory() method docs for the Factory class.  Everything works 
perfectly now.

Jay Deiman


More information about the Twisted-Python mailing list