Re: Reactor events help request ..

[email protected]
Newsgroups gmane.comp.python.twisted.web
Message-ID <20100224143333.2792.1169113255.divmod.xquotient.60@localhost.localdomain>
On 01:12 am, [email protected] wrote:
>
>Hi Folks ..
>
>I'm not entirely a newbie a python and twisted, but I have come to the
>point where I need a bit more expertise on this topic, so I am hoping
>that I have come to the right place ..
>
>What  I'm hoping, that  you folks can help out with a minor problem 
>that
>I am having with the twistd reactor class and/or the callLater function
>
>I have been using a reactor.callLater function to schedule an event 
>that
>happens in the reactor to send out a heartbeat type message at regular
>intervals .. This works great !
>
>However, it appears to me that the self.sendLine(msg)  and or the
>self.transport.write(msg) writing  functions are blocked functions
>waiting for a reactor event to occur at a future scheduled time before
>acutally flushing out the internal write buffers ..

This isn't the intended behavior.  The most common mistake which leads 
to it is trying to use Twisted APIs such as these from a different 
thread than the one where reactor.run() was called.  The only thread- 
safe Twisted API is reactor.callFromThread.

You didn't say anything about threads in your post, so I don't know if 
this is the problem you're having, but since it's so common I thought 
I'd mention it.

Jean-Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.