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



On Sat, Dec 20, 2003 at 10:01:55PM +0100, Alexander Terekhov wrote:
> Nathan Myers wrote:
> [...]
> > Uncountably many libraries, though, would reasonably be expected 
> > to fail (e.g. corrupt memory, leak resources) if such an 
> > unexpected exception ripped through.
> 
> All those libraries are simply NOT thread-cancel-safe (and I mean 
> synchronous, not asynchronous cancelation). Well, you might want 
> to take a look at http://tinyurl.com/33kjj and, uhmm, yeah,
> http://tinyurl.com/2zcq6 (I guess that you have a sort of similar 
> problem... except that you're dealing with code that was never 
> meant to be thread-cancel-safe, to begin with).

OK, I have read those.

Unlike you, I have no interest in maintaining compatibility for the
sake of existing thread-cancel-safe libraries.  I don't know of any, 
and doubt more than a few exist.  I do know, however, of thousands 
upon thousands of ordinary thread-safe libraries.  I don't believe 
that the goal of a "thread-cancel-safe" library (that must take special
pains to achieve it) is desirable, nor, in the case of a C library, 
possible in general.

Therefore, I'm interested in defining semantics for a C++ binding that
allows use of existing (well-written) libraries, that are only normally
thread-safe, in threads that might suffer cancellation .  I'm interested 
in comments on whether the  semantics I posted would work, and in any 
suggested improvements.  If the model works, and "we" implement it, it 
should be easy enough to get some standards body to ratify it.

Nathan Myers
ncm@xxxxxxxxxxx