[Python-ideas] Thread stopping
Gregory P. Smith
greg at krypto.org
Sat Mar 31 01:02:08 CEST 2012
On Thu, Mar 29, 2012 at 9:53 PM, Eli Bendersky <eliben at gmail.com> wrote:
> On Thu, Mar 29, 2012 at 21:48, Andrew Svetlov <andrew.svetlov at gmail.com>wrote:
>
>> I propose to add Thread.interrupt() function.
>>
> <snip>
>
> Could you specify some use cases where you believe this would be better
> than explicitly asking the thread to stop?
>
> Eli
>
The only case I can come up with is wanting to attempt to force a "clean"
shutdown of threads spawned by library code out of the main processes
control that has not been instrumented with its own well placed checks to
see if it is time to shut down.
Given such a mechanism can't interrupt blocking system calls or extension
module or other VM native language level code, I'm not super excited about
implementing this given the limitations.
It would be relatively easy to add, I just don't see a huge benefit.
As for using SystemExit as the exception or exception base class, I believe
existing code such so some well known event loops catches, logs and ignores
SystemExit today... ;)
-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120330/eed756e1/attachment.html>
More information about the Python-ideas
mailing list