[Twisted-Python] dumb question on qt4reactor

Kevin Mcintyre kebin70 at gmail.com
Wed Jul 9 11:11:36 MDT 2014


Another "Oh right" twisted moment.  callInThread instead of callLater?

This is a case where I've been laying tracks for 2 years without totally
understanding the train that was eventually coming down the tracks.  I
guess I implicitly understood by wanting to move to a separate reactor as a
separate thread, and in the past when I've used callLater it's encapsulated
non-blocking code.

In this sense is callLater ever utilized as a pseudo asynchronous method?



On Sat, Jul 5, 2014 at 5:24 PM, <exarkun at twistedmatrix.com> wrote:

> On 5 Jul, 08:35 pm, kebin70 at gmail.com wrote:
>
>> calling reactor.callLater within qt4reactor in an attempt to async non
>> webkit work but not seeing expected behavior.  Webkit locks while the
>> callLater function executes.
>>
>
> `callLater` does not make a blocking function into a non-blocking one. It
> just calls a function after a specified delay.  If the function blocks,
> then the reactor will block when it gets around to calling it.
>
> If you need to call blocking APIs you may need to call them in a separate
> thread (Twisted includes a threadpool that can help you with this) or a
> separate process (Twisted has some APIs for launching and interacting with
> other processes, too).  Of course, the ideal solution is often to find a
> non-blocking equivalent to the blocking API and use that instead (for
> example, I know that txaws is a project that exists - perhaps it can do the
> things to S3 that you want to do).
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140709/03c18de4/attachment-0002.html>


More information about the Twisted-Python mailing list