Re: [c++-pthreads] cancellation points report failure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] cancellation points report failure



Nathan Myers <ncm@xxxxxxxxxxx> writes:

> On Fri, Dec 19, 2003 at 10:28:46AM -0800, Matt Austern wrote:
>> 
>> One possible solution (perhaps overly drastic): in C++, eliminate
>> all cancelation points except for pthread_testcancel.
>
> Another would be for those functions identified as cancellation 
> points to report failure.  In particular, a read() call should return 
> immediately.  Existing (good) code has to handle normal failures 
> already.  Well-designed library code will propagate the failure up 
> to the point where a check for cancellation, and throw, may occur.  

Ingenious!  I'm not sure about all the implications, but I think we
should explore this idea further.  In hindsight, it's almost obvious:
a function should only report failure in one way.  Requiring
programmers to deal with exceptions *and* failure status makes the
whole thing unwieldy and error-prone.

Nice one, Nathan.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com