[c++-pthreads] What are the real issues?

Matt Austern austern at apple.com
Tue Jan 6 21:29:22 UTC 2004


On Jan 6, 2004, at 1:12 PM, Nathan Myers wrote:

>> ... I think the really fundamental issue is whether a thread
>> should be allowed to receive a cancellation request, start to do some
>> work as a result of the request, and then decide that it doesn't want
>> to be cancelled.
>
> Nobody has proposed any such thing.

Really?  I think that you and I both did.
  (1) My proposal (which may or may not be a good idea, but which
        I think should be considered) is that cancellation could be
        represented by an ordinary exception instead of by a special
        kind of exception with forced unwinding semantics.  This would
        allow a thread to catch the exception, set a flag, swallow the
        exception, and continue executing.  that is, it would allow a
        thread to receive and act on a cancellation request but for it 
not
        to be canceled.
  (2) Your proposal is that the POSIX functions that are currently
        described as cancellation points shouldn't raise any kind of
        exception and shouldn't cause the thread to stop executing,
        but should instead return an error code.  Again, this would allow
        a thread to note the error return, check errno to see if it's
        ETHREADCANCELED, set a flag as a result of having received
        the cancelation request, and continue executing.  Again, your
        proposal would allow a thread to receive and act on a 
cancellation
        request without being canceled.

I'm not sure whether making this possible is a good thing or a bad
thing.  If we think it's good, then that would simplify the design.

			--Matt





More information about the c++-pthreads mailing list