mutex::scoped_lock question

Hello, all ... 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! Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.com

jmzorko@mac.com writes:
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 -- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
participants (2)
-
Anthony Williams
-
jmzorko@mac.com