[c++-pthreads] Re: cancellation points report failure
Alexander Terekhov
boo at terekhov.de
Thu Jan 8 16:22:12 UTC 2004
Fergus Henderson wrote:
[...]
> > > Asynchronous cancelability only works if you can be sure that there
> > > are no implicit calls to async-cancel-unsafe functions going on.
> >
> > Yep (and probably also C++ things like throw-expressions and "try
> > {").
>
> "probably" is the word.
I said "probably" because apart from inherently async-cancel-unsafe
operations/functions like operator new()/operator delete() (and
alike), a smart compiler understanding the meaning of async_cancel{}
and sync_cancel{} (and also no_cancel{}) "probably" can translate
things like
void f() async_cancel_safe {
/*...*/
sync_static T t(/*...*/); // synchronizised local static
t.async_cancel_safe_operation();
}
to
void f() async_cancel_safe {
/*...*/
sync_cancel {
sync_static T t(/*...*/); // synchronizised local static
async_cancel {
t.async_cancel_safe_operation();
}
}
}
> That's what I mean -- in C++, you can't even
> tell which language constructs might be implemented with code which
> under-the-hood is going to be doing dynamic memory allocation or other
> async-cancel-unsafe operations.
So, you really want to me stick to POF*** not only for signal
handlers, but also for async-cancel-safe regions? Well, thankyou.
regards,
alexander.
***) http://groups.google.com/groups?selm=3F169C13.D83AA51E%40web.de
(Subject: Re: Thread function and C++)
More information about the c++-pthreads
mailing list