Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-05-23 13:44:43


graydon hoare wrote:
>
> Alexander Terekhov <terekhov_at_[hidden]> writes:
>
> > graydon hoare wrote:
> > > that said, there's a lot of linuxthreads *behavior* which was cleaned
> > > up in NPTL (eg. signals) so you may well find a kludge or two which no
> > > longer need to be used, or which are masking / working around correct
> > > behavior.
> >
> > Well, for your information...
> >
> > http://listman.redhat.com/archives/phil-list/2003-May/msg00036.html
> > (Subject: Re: nptl 0.38)
> > ...
>
> this is a curious string of fragments of messages and links to similar
> messages; unfortunately I cannot get a clear picture of the actual
> *problem* you're pointing to.

That's OK. ;-)

> is there something wrong with the way
> NPTL translates thread cancellation into C++ exceptions?

Yes. The wrong thing is that NPTL *DOESN'T* "translate" thread
cancelation (and thread exit) into a C++ exception... ala

http://groups.google.com/groups?selm=3EC382B0.BE8CD854%40web.de

extern "C" void pthread_exit(void * ptr) {
  std::thread_exit(ptr);
}

using something along the lines of: (from the "std" namespace)

class thread_termination_request : public std::exception ...
class thread_cancel_request : public std::thread_termination_request ...
class thread_exit_request : public std::thread_termination_request ...

template<typename T>
class thread_exit_value : public std::thread_exit_request ...

template<typename T>
void thread_exit(T value) {
  assert(std::thread_self().can_exit_with<T>());
  throw thread_exit_value(value);
}

("or something like that").

> or are you
> just frustrated with C++ exceptions in general (aren't we all?)

The C++ standard is broken and that's why I'm a bit "frustrated",
that's true. Now, would you please read ALL articles in the
following c.p.t. thread:

http://tinyurl.com/ciic
(Subject: __attribute__((cleanup(function)) versus try/finally)

regards,
alexander.

--
"}; // Dear WG21 {co-}liaison/member, please: http://tinyurl.com/chl6"

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