This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients
Date 2002-01-14.08:40:22
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=21627

On (1): This is quite unfortunate, as I do think sys.exit
and thread.exit should do different things. There would be
approaches of further subclassing SystemExit; preserving the
property that raising SystemExit in a thread exits the
thread only - would such a solution be acceptable?

On (2): This is no different from raising SystemExit in the
main thread, which also does not invoke finally clauses in
other threads.

I don't think there can be a complete, reliable
implementation of thread cancellation, only a best-effort
approach. For POSIX, I'd suggest sending SIGUSR2 to each
thread through pthread_kill. 

We might need to add a mechanism indicating whether a thread
is ready to be cancelled, similar to the POSIX cancellation
points. That would prevent the signal from arriving in an
arbitrary library function, and defer thread termination
until the library function completes. For blocking system
calls, sending signals would need to be activated
explicitly, to allow aborting them.
History
Date User Action Args
2007-08-23 16:01:58adminlinkissue502236 messages
2007-08-23 16:01:58admincreate