[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost


  • To: David Abrahams <dave@xxxxxxxxxxxxxxxxxxxx>
  • Subject: Re: [c++-pthreads] Re: FW: RE: Re: I'm Lost
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Wed, 08 Mar 2006 08:51:56 -0800

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@xxxxxxxxxxxxxxxx
(650) 331-3385 x713