[c++-pthreads] Re: pthread_cancel and EH: let's try this again
Nathan Myers
ncm at cantrip.org
Tue Jul 19 17:59:12 UTC 2005
On Tue, Jul 19, 2005 at 01:51:34AM +0200, Alexander Terekhov wrote:
> Nathan Myers wrote:
> > On Mon, Jul 18, 2005 at 02:20:10AM +0200, Alexander Terekhov wrote:
> > > Wil Evers wrote:
> > > > {
> > > > cancellation_manager enabler(true);
> > > > some_cancellation_point();
> > > > }
> > >
> > > Never do that in "library" code.
> >
> > First, it's not in "library code". It's in thread-main.
>
> new_thread(library_call, arg);
>
> Where's "thread-main"?
"Thread-main" is a conventional term in thread programming for the
function whose activation record is at the bottom of the thread's
stack. This function cannot return without terminating the thread,
just as program main() cannot return without exiting the program.
> > Second, when the default is to have cancellation off, design
> > heurisitics change accordingly. It would be perfectly reasonable
> > to enable (some form of) cancellation, temporarily, inside a library
> > that necessarily must have been called with it turned off.
>
> And how would you really turn it off (depending on client's
> need/context), then?
If *I* didn't want the thread cancelled, I would simply choose not to
cancel it. If the client calls into a library that promises to throw
if it can't satisfy its postconditions, then it might get an exception
to deal with. What was the question?
Nathan Myers
ncm at codesourcery.com
ncm at cantrip.org
More information about the c++-pthreads
mailing list