[Twisted-Python] Twisted and python threading
Andrew Bennetts
andrew at bemusement.org
Thu Mar 18 06:08:25 EDT 2010
(*)·´`·.¸.»ÐëÄdMäñ·´`·.¸.»(*) wrote:
> Hi,
>
> I'm trying to spawn a threading.Thread from a Twisted application, but
> the thread won't start unless I schedule the the code with
> reactor.callLater(), any Ideas ?
Twisted doesn't affect threading.Thread at all.
You haven't given much detail, so my best guess is that you are calling
Twisted APIs from a non-reactor thread. Twisted's APIs are generally
*not* thread-safe, so that will give undefined behaviour (like nothing
happening when it should). Basically the only API you should use is
reactor.callFromThread. See
<http://twistedmatrix.com/documents/current/core/howto/threading.html>.
If that's not your problem, you'll have to elaborate more on what your
problem (like what precisely you mean by “thread won't start”) and how
to reproduce it.
-Andrew.
More information about the Twisted-Python
mailing list