[Twisted-Python] dumb question on qt4reactor

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sat Jul 5 18:24:56 MDT 2014


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




More information about the Twisted-Python mailing list