From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-01-14 10:12:24
--- In boost_at_y..., Jens Maurer <Jens.Maurer_at_g...> wrote:
> Lee Brown wrote:
> > I do have one question: why doesn't Boost.threads seem to support
> > thread cancelation? It doesn't seem to be mentioned in the
> Thread cancelation is difficult to do correctly in a C++ program,
> because you want to run all the destructors of stack objects of
> the thread being canceled.
> Bill Kempf might want to elaborate.
It's not so much that it's difficult to implement, as it's difficult
to implement portably. There's also the issue of carefully and
correctly specifying cancellation behavior. As Jens points out you
need to insure that the stack is properly unwound, and this means an
exception or an exception like concept. The best choice seems to be
to use an actual exception, but then several questions arise. Should
the user be able to catch the exception? If they do, should they be
able to "eat" the exception (i.e. catch but not re-throw)? How can
you (easily) deal with the possiblity of an exception thrown during
stack unwinding of another exception? Should asynchronous
cancellation be allowed (this means that ALL functions can throw an
exception, which is a huge burden on the user, the compiler and the
runtime, and means some standards conforming code today would no
longer be conforming if this were part of the standard)?
Cancellation is being evaluated, and will eventually be added to
Boost.Threads. Because of the issues above, however, I can't predict
when this will be.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk