
25 Aug
2007
25 Aug
'07
1:39 p.m.
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