[Twisted-Python] Twisted, wxPython & PyPubSub

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Sep 7 10:36:11 EDT 2009

On 02:21 pm, gabriel.rossetti at arimaz.com wrote:
>Hello everyone,
>I am using wx with twisted and pubsub (not the on in wx but the
>independent one) to notify each one of what is going on. I was 
>if I should use reactor.callFromThread to call publisher.sendMessage or
>not? I haven't been doing that until now but I wondered if it was 
>better to.

Use reactor.callFromThread if you have code running in a non-reactor 
thread and you want it to initiate some action in the reactor thread.

So, if publisher.sendMessage is using Twisted APIs or otherwise requires 
that it be run only in the reactor thread, and you need to use it from a 
non-reactor thread, then use reactor.callFromThread.  Otherwise, don't.


More information about the Twisted-Python mailing list