[Twisted-Python] A problem with very long blocking thread in Twisted
Heungsub Lee
h at subl.ee
Wed Aug 10 07:49:07 MDT 2011
Hi, fellow programmers.
I have a problem with very long blocking thread(may not be finished) in
Twisted.
from socket import *
> from twisted.internet import reactor
> def consuming():
> while reactor.running:
> amqp_consumer.wait() # waiting for very long time or forever
> reactor.callInThread(consuming)
The process follows the below timeline:
>--: Started
---: Process
--X: Terminated
^ : Keyboard Input
Now
main loop |>--------------------X
thread | >--------------------------------------------... long time later
...---X
^
[Ctrl]+C
Ideal
main loop |>--------------------X
thread | >-------------------X
^
[Ctrl]+C
To solve this problem, I'd like to set threads as daemon. So that all
related threads are terminated when main loop is interrupted. Any idea on
this problem will be appreciated.
–––––––––––––––––––––––––––
*
Heungsub Lee
sublee
Mobile: +82-10-3215-2380
Site: http://subl.ee/
GitHub: http://github.com/sublee
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110810/f3731d29/attachment.html>
More information about the Twisted-Python
mailing list