[Twisted-Python] blocking question
Jp Calderone
exarkun at intarweb.us
Thu Apr 17 21:33:38 MDT 2003
On Thu, Apr 17, 2003 at 11:15:06PM -0400, Konrad Rokicki wrote:
> Hey everyone, newbie question:
> Are there any Python/Twisted idioms for doing blocking? More specifically,
> in a client I have a method to send a query to the server and another
> method that gets called when the query is answered. Is there an easy way
> to say "send the query then wait x seconds for it to return in this
> function"?
Like this, probably:
d = queryFunction()
d.setTimeout(x)
d.addCallbacks(handleAnswer, queryTimedOut)
reactor.run()
For more, http://www.twistedmatrix.com/documents/howto/
> It seems like blocking is taboo in twisted and if anyone has an
> alternative I'd be glad to hear it.
It's not a taboo, it's just not done ;)
Jp
--
C/C++/Java/Perl/Python/Smalltalk/PHP/ASP/XML/Linux (User+Admin)
Genetic Algorithms/Genetic Programming/Neural Networks
Networking/Multithreading/Legacy Code Maintenance/OpenGL
See my complete resume at http://intarweb.us:8080/
--
up 28 days, 23:02, 11 users, load average: 0.08, 0.14, 0.10
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20030417/0c4c5e29/attachment.sig>
More information about the Twisted-Python
mailing list