Killing threads (was Re: Cancel or timeout a long running regular expression)
greg.ewing at canterbury.ac.nz
Mon Sep 19 01:56:42 EDT 2011
Ian Kelly wrote:
> And what if the thread gets killed a second time while it's in the except block?
> And what if the thread gets killed in the middle of the commit?
For these kinds of reasons, any feature for raising asynchronous
exceptions in another thread would need to come with some related
* A way of blocking asynchronous exceptions around a critical
section would be needed.
* Once an asynchronous exception has been raised, further
asynchronous exceptions should be blocked until explicitly
* Asynchronous exceptions should probably be disabled initially
in a new thread until it explicitly enables them.
Some care would still be required to write code that is robust
in the presence of asynchronous exceptions, but given these
facilities, it ought to be possible.
More information about the Python-list