Re: [c++-pthreads] Re: thread-safety definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: thread-safety definition



Ted Baker wrote:
> 
> The 2003 Single Unix Specification, and POSIX, say:
> 
> "...The thread invokes the cancellation cleanup handler with
> cancellation disabled until the last cancellation cleanup handler
> returns...."

This is about POSIX thread termination, not pthread_cleanup_pop() with 
a non-zero execute argument. See also TC2 (Change Number: XSH/TC2/D6/7 
[XSH ERN 77]). The latest draft is available here:

www.opengroup.org/austin/restricted/tc2d6/P1003_1-2001-Corr-2-d6.pdf

regards,
alexander.

> 
> --Ted
> 
> On Mon, Jan 12, 2004 at 02:20:42PM +0100, Alexander Terekhov wrote:
> > Fergus Henderson wrote:
> > [...]
> > > > This cannot happen if cancellation is automagically disabled during
> > > > execution of (all) destructors, along with the stack unwinding code
> > > > that is performed during exception processing.
> > >
> > > If all cleanup is done via destructors (or pthread_cleanup_push,
> > > which can be handled similarly), you are right.
> >
> > AFAIK, POSIX doesn't disable cancellation when thread cleanup handler
> > is invoked by pthread_cleanup_pop() call with a non-zero execute
> > argument (cancellation is disabled when the thread exits [that is,
> > calls pthread_exit()] or acts upon a cancellation request delivery).
> >
> > I do it "manually".
> >
> > regards,
> > alexander.