[Twisted-Python] sleeping in inlineCallbacks
Matt Perry
matt at unshift.net
Wed Oct 7 13:46:05 MDT 2009
reactor.callLater() is the best way to delay a certain function call.
sleep() will block the entire program from running, which you probably don't
want to do.
On Wed, Oct 7, 2009 at 3:35 PM, Paul Thomas
<spongelavapaul at googlemail.com>wrote:
>
> On 7 Oct 2009, at 20:30, Paul Thomas wrote:
>
> > Is there any way to do something like "yield sleep(10)" inside an
> > @inlineCallbacks method?
>
> I realise I can do this:
>
> def sleep(seconds):
> d = defer.Deferred()
> reactor.callLater(seconds, d.callback, seconds)
> return d
>
> but I wondered if something like that is already in the libraries?
>
> _______________________________________________
> 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/20091007/336d4567/attachment.html>
More information about the Twisted-Python
mailing list