From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-11-01 16:39:15
Peter Dimov wrote:
> class X
> mutex mx_;
> void lock();
> void unlock();
Ok, I understand.
But how's about the (admittedly strange looking) solution:
if (0 == lk_) lk_.reset(new mutex::scoped_lock);
Hmm, I am not sure about the implications of thread_specific_ptr
being used as a member. Will need to investigate...
But in principle it is the same kind of trick I would need to
apply if providing lock/unlock on my POD mutex type.
I agree however, that a cleaner interface in this respect would be
direct access to mutex.lock() mutex.unlock().
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk