[c++-pthreads] cancellation points report failure

Ted Baker baker at cs.fsu.edu
Fri Dec 19 20:57:46 UTC 2003


How do you propose to prevent cancelation occurring (i.e., the
thread starts executing the cleanup routines and then exits) if a
C++ library function uses an underlying C library call that is a
thread cancelation point?

Are you figuring on redoing all the libraries to avoid calls
to such C functions?

--Ted

> >> 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.



More information about the c++-pthreads mailing list