Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-03-25 19:54:43


Howard Hinnant wrote:

> What has me worried about adding try/timed_join to N2184 is actually
> N2178! :-)

:-)

But that is why N2178 also has pthread_*join2_np. The amount of work that is
required from a pthread implementation to make pthread_cancel C++ friendly
is much more than what's needed to provide the extensions.

> The other, extremely remote, possibility is to ask the posix group to
> add pthread_try_join and pthread_timed_join. They might even be
> willing to do this. However there is just no way we're going to get
> that committee to mandate that pthread_cancel emits a catchable C++
> exception.

I just got permission to quote Hans Boehm here, since he put it much better
than I could in a post to POSIX-C++:

"To me, this reaction makes perfect sense in many contexts, but I'm not
sure it makes sense here. I do not work with the people at HP who would
have to fix this. But what I've heard in the past is that there is
enough dissatisfaction with the fact that cancellation & C++ basically
doesn't work that most people would like to see this fixed. The hassle
involved in doing the work is probably less than that of listening to
the continuous complaints.

My impression is that this is probably one of the more superficial
problems with C++ & pthreads, but it seems to be the one that draws the
most complaints. And implementers would like guidance as to the correct
solution."

It seems very likely to me that once threads are officially recognized by
the C++ standard, the customers will demand unified C/C++ cancelation, and
do that loudly. So regardless of what the POSIX committee says,
pthread_cancel will start throwing something that looks like an exception to
C++ code, earlier or later. We should be prepared for that.


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