pthread_cancel and EH: let's try this again
Alexander Terekhov
terekhov at web.de
Tue Jul 19 19:45:39 UTC 2005
Nathan Myers wrote:
[...]
> > 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.
I suppose you're after exit(main()) in initial thread and
pthread_exit(start_routine(arg)) in other threads. What makes you
think that library_call isn't start_routine (aka conventional
"thread-main" in your thread programming neighborhood), or its
equivalent apart from "activation records"?
>
> > > 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?
Same question. If you never cancel a thread, it's all moot. My
question was about control of cancellation in a thread that can
be a target of pthread_cancel().
regards,
alexander.
More information about the c++-pthreads
mailing list