[c++-pthreads] What are the real issues?
Ted Baker
baker at cs.fsu.edu
Wed Jan 7 21:47:31 UTC 2004
> No, the thread remains cancelled. The difference between that and
> the thread actually discarding the cancellation request is that the
> next time a function identified as a cancellation point is called, it
> fails, too. The cancellation is not lost, or discarded, or ignored;
> it surfaces again and again, indefinitely, as long as the thread fails
> to terminate. Furthermore, a subsequent (e.g.) filebuf operation
> would actually throw. If that exception were caught and discarded,
> the next would throw again. Somebody described this as "sticky
> cancellation".
> Under POSIX C, a thread cancellation handler can continue to run
> indefinitely, so you're not describing something fundamentally different
> from the C model. Likewise, if unwinding were to run catch clauses,
> code in a catch clause could continue to run indefinitely.
The situation is not exactly the same: You are asking, at least,
for some way to poll whether the thread has been cancelled, so that
your subsequent cancellation-point operations will know to "fail".
You will also need to modify the semantics of cancellation cleanup
handlers, so that they are executed on the way out as you exit
their scopes (possibly via normal transfers of control).
--Ted
More information about the c++-pthreads
mailing list