Boost logo

Boost Users :

From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-07-21 02:54:35


Ruediger Berlich <ruediger.berlich_at_[hidden]> writes:

> Hi there,
> just a short question:
>
> http://www.boost.org/doc/libs/1_35_0/doc/html/thread/thread_management.html#interruption_points
>
> lists the following interruption points:
>
> * boost::thread::join()
> * boost::thread::timed_join()
> * boost::condition_variable::wait()
> * boost::condition_variable::timed_wait()
> * boost::condition_variable_any::wait()
> * boost::condition_variable_any::timed_wait()
> * boost::thread::sleep()
> * boost::this_thread::sleep()
> * boost::this_thread::interruption_point()
>
> Is (and if so: why is) a lock on a mutex no interruption point ?

Mutex locking is not an interruption point.

First off, mutex locking is not a POSIX cancellation point. Though
interruption and cancellation are different mechanisms, the list of
cancellation points seemed a good place to start with for choosing
interruption points.

Secondly, this would add overhead to the mutex locking, which I think
is undesirable.

Thirdly, it would require lots of code that locks mutexes to disable
interruption in order to not be interrupted during a critical
operation.

You can always write an interruptible_mutex that does allow
interruption on top of the basic primitives.

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net