[Twisted-Python] reactor and thread

glyph at divmod.com glyph at divmod.com
Wed Jun 13 20:05:06 MDT 2007


Gábor Bernáth already answered your question, but I'd like to answer as 
specifically as possible for future readers who may discover this 
message.

On 13 Jun, 06:21 pm, michele.petrazzo at unipex.it wrote:
>    reactor.call_in_main_thrad(callBack)

This is spelled:

    reactor.callFromThread(callBack)
>reactor.callIntoThread(tid, funct, callBack)

This is spelled:

    from twisted.internet.threads import deferToThread
    deferToThread(funct).addCallback(callBack)
>Is this possible with twisted? (Does I'm dreaming?)

This, and many other fun features of the reactor, can be discovered by 
reading the twisted.internet interface documentation, available here:

http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.html

You can read more specifically about threads here:

http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorThreads.html

I hope this proves useful to you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20070614/f58f6599/attachment.html>


More information about the Twisted-Python mailing list