Boost logo

Boost :

From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2007-08-25 09:39:33


On Friday 24 August 2007 09:57, Phil Endecott wrote:
> In the same vein, I have sometimes considered making the use of these
> primitives even more idiot-proof by bundling together a mutex,
> condition and the variable that they protect:
>
> template <typename T>
> class locked {
> mutex m;
> condition c;
> T v;
> };

You might be interested in this paper, which describes a nice way of
wrapping an object so a mutex in the wrapper is always locked when
accessing the object's member functions.
 
http://www.research.att.com/~bs/wrapper.pdf

-- 
Frank



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