[Twisted-Python] stop conditions and deferToThread()
Phil Mayers
p.mayers at imperial.ac.uk
Wed Jun 10 04:18:30 MDT 2009
Thomas Jakobsen wrote:
> Hi
>
> As discussed in a previous thread
>
> http://twistedmatrix.com/pipermail/twisted-python/2009-May/019717.html
>
> a task put in its own thread via deferToThread() won't stop even
> though the reactor has stopped. It has to carry out its own check that
> the reactor is running and stop if that is not the case.
>
> My question is: Is it possible to use anything else than the
> reactor.running as stop condition in this way? In my current twisted
> application I would like to keep the reactor running but still have
> some deferToThread jobs stop if e.g. an exception occurs in one of the
> jobs.
A threading.Event object?
Can you run the jobs as sub-processes? Then you could just kill them.
More information about the Twisted-Python
mailing list