[c++-pthreads] Re: FW: RE: Re: I'm Lost
Mark Mitchell
mark at codesourcery.com
Wed Mar 8 16:51:56 UTC 2006
David Abrahams wrote:
> I do have sympathy, incidentally, for the other side's desire to "try
> really hard" to shut a thread down cleanly. I just don't happen to
> think unstoppable exceptions are a particularly effective tool for
> that job.
Exactly.
We have SIGKILL for processes so that we can be sure to get rid of them.
(Well, modulo the situations where that doesn't work...) But,
pthread_cancel is not analogous: for example a thread can run with
cancellation disabled, while a process cannot block SIGKILL. The reason
that people object to a pthread_kill is that there is no obvious way to
clean up memory resources, etc., allocated by the thread, in the same
way that the OS can reclaim resources used by a process. So, a
cooperative model makes sense.
I don't think we should support unstoppable exceptions at all. Silently
rethrowing at the end of a catch handler breaks too many important
invariants.
--
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713
More information about the c++-pthreads
mailing list