Cancelling a python thread (revisited...)

John Nagle nagle at animats.com
Mon Nov 9 00:04:06 EST 2009


Antoine Pitrou wrote:
> John Nagle <nagle <at> animats.com> writes:
>>     I'd argue against general thread cancellation.  Inter-thread
>> signals, though, have safety problems no worse than the first-thread
>> only signals we have now.  You're allowed to raise an exception
>> in a signal handler, which is effectively thread cancellation.
> 
> Can you give an example of such "cancellation"?
> In any case, this would be a side-effect of the current implementation, not
> officially supported behaviour.

    It's not only documented behavior, it's an example in the official 
documentation.  See

	http://docs.python.org/library/signal.html#example

where an exception is raised in a signal handler.

				John Nagle



More information about the Python-list mailing list