From: Howard Hinnant (hinnant_at_[hidden])
Date: 2007-10-30 18:24:32
On Oct 30, 2007, at 2:03 PM, Phil Endecott wrote:
> Howard Hinnant wrote:
>> Actually thread cancellation is old. Many (not all) thread API's
>> have some form or another of cancellation. That being said, the
>> compromise reached at the Kona meeting 4 weeks ago was to remove
>> cancellation (or interruption) from the proposal. This removal is
>> reflected in N2411.
> That's unfortunate. I'm a little confused about how completely
> removing it is a "compromise"!
> This is something that I need. Does anyone know of an alternative
> (POSIX-compatible) C++ thread library that offers cancellation? If
> I may try to write on.
A partial workaround is to religiously use cv::timed_wait, as opposed
to cv::wait, so that you can wake up and discover if you're supposed
to quit every once in a while. It should be easy to set up a
"cancel" flag that a thread can periodically check. For example you
could just pass a ref(bool) as one of the arguments in your thread-
main function and reference that argument with thread local data.
One will still have trouble waking from blocked system calls, but
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk