Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2007-11-02 12:24:25


Alexander Terekhov wrote:
> Anthony Williams wrote:
> [...]
>> N2420 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2420.pdf)
>> covers some of the relevant ground --- it's the minutes of the POSIX/C++
>> liaison committee.
>
> "Gnu gcc and Solaris pthreads: The Gnu gcc and Solaris pthreads
> implementations are two known implementations that attempt to map
> POSIX pthread cancellation onto C++ exception handling, but both
> do so at the cost of breaking the exception model (i.e., they no
> longer conform to ISO C++) because the alternative appears to be
> that C++ destructors and catch blocks would not be invoked for
> cancellation which would mean that resources would be leaked."
>
> Uhmm. Don't know about (modern) Solaris, but glibc (presumably
> that is meant by "Gnu gcc pthreads implementation") does invoke
> C++ destructors and catch blocks. But instead of using ordinary
> exceptions, it uses "forced unwinding" for thread cancel and
> exit. For some unknown reason (other than "I say it must be
> so"), glibc maintainer Drepper of Red Hat simply refuses to
> even contemplate changing it to use ordinary exceptions instead
> of "forced unwinding"... and I suspect that is the reason why
> WG21 was asked to drop standardization of thread cancel (and exit)
> as exceptions.

Yep, Ulrich Drepper was one of the people involved, but there were
others also concerned.

I suspect Boost will run into some platforms where we can't rely on some
of the out-of-the-box native functionality, and have to do a certain
amount of wrapping or reimplementing. But that doesn't mean we shouldn't
try. There are a lot of smart people contributing ideas for
Boost.Threads, and with enough minds on these issues we have a
reasonable chance of resolving these issues.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk