From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-06-09 04:22:36
> I've a very simple question, but i've not found my answer in the
> Boost source. How do I manually acquire the lock on a
> boost::mutex::scoped_lock() e.g. without using the constructor? The
> reason is that I need to make my instance of the lock on the heap, so
> I want to use the default ctor and acquire (and release) the lock
> myself. I'm wrapping the scoped_lock in another higher-level class
> (called Lock, funnily enough) and I want to insulate the code above
> me from specifics.
> I'm going to continue looking through the source, but any help would
> be appreciated!
The constructor to mutex::scoped_lock takes a second parameter, which is a
bool indicating whether the lock should be acquired. If this parameter is
false, then the lock is not acquired on construction.
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk