Boost logo

Threads-Devel :

From: Kai Brüning (kai_at_[hidden])
Date: 2007-07-25 17:52:07

>On Monday 23 July 2007 10:26, Kai Brüning wrote:
>> Hi,
>> I have been using a two-layer wrapper for boost mutex recently. One
>> layer to create levelled mutexes as described by Anthony, and another
>> one to track the locked/unlocked state together with the owning thread
>> for debug purposes.
>Yes, my imagined debug mutex would also keep track of the owning thread,
>because the other component I want is a way to make sure a given piece of
>data (or more generally an object) is always protected by a mutex when
>accessed. My idea here is fuzzier, I'm thinking something like a
>shared_ptr whose get() function checks to make sure there exists a mutex
>which is already locked by the current thread, and was also locked on
>every previous get() call.

Do you know A. Alexandrescu's article "volatile - Multithreaded Programmer's Best Friend"? ( He describes a LockingPtr in this article and uses the C++ type system to get some compile-time checking of correct locking.


Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at