[Twisted-Python] reactor.stop() and thread and wxPython problem

Reza Lotun reza at getpeer.com
Fri Jan 16 04:08:24 EST 2009

Hi Gabriel,

I don't quite understand your question. Do you mean to say that you
have written some code with wx and Twisted in an integrated event
loop, and are doing something like reactor.callInThread(someCall), and
when you call reactor.stop the app doesn't exit? AFAIK, any thread
spawning goes through Twisted's internal thread pool and thread
joining should be handled by reactor.stop - I suppose it depends on
what those threads are doing.

Based on my experience with wx and Twisted, I found the following
works quite well:

* Have the reactor run in a seperate thread from wx (making sure to
use reactor.run(installSignalHandlers=False))
* Spawn threads from wx->Twisted in the proper way: use

Hope this helped,

On Fri, Jan 16, 2009 at 7:37 AM, Gabriel Rossetti
<gabriel.rossetti at arimaz.com> wrote:
> Hello everyone,
> I have written some code using Twisted that spawns threads and another using
> wxPython integration. For some reason when reactor.stop() is called they
> don't always exit. I suspect that the reactor is waiting on the threads to
> finish, which they apparently don't do, and as for the wx integration, I
> don't know, maybe wx's main loop is in a separate thread and it would be the
> same problem. Does anyone know/have an idea or has anyone else experienced
> this?
> Thank you,
> Gabriel
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reza Lotun
Senior Software Engineer
Peer Technologies Limited
reza at getpeer.com

More information about the Twisted-Python mailing list