[PATCH] thread cancellation via C++ exception
Alexander Terekhov
boo at terekhov.de
Tue May 18 11:11:23 UTC 2004
http://www.redhat.com/archives/phil-list/2004-May/msg00016.html
<quote>
Cancellation, as the word already suggests, is final. There mustn't
be any catch without rethrow. The thread library does, and will
probably even more so in future, alter the state of the library once
a thread is canceled and this is not reversible.
</quote>
This is utter crap. The only "state" affected by thread cancel
request delivery is the cancellation state and mode. They must be
set to PTHREAD_CANCEL_DISABLE and PTHREAD_CANCEL_DEFERRED
respectively. There's no rational reason whatsoever for thread
cancel (and even exit) exceptions [std::thread_cancel_request and
std::thread_exit_request; both "is a"
std::thread_termination_request) to NOT be finalizable by some
user's catch()-without-rethrow.
regards,
alexander.
More information about the c++-pthreads
mailing list