Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-07-21 16:28:18


Russell Hind wrote:
>
> Fair enough. My most common use is for automatically
> locking/unlocking
>
> void function(void)
> {
> scoped_lock lock(themutex);
> ... do something
> lock.unlock();
> ... do some more
> lock.lock();
> ... do something else
> }
>
> with possible a while-loop around the unlock/lock code. From this, I
> have seen it as a coding error if I call lock without an unlock but
> this probably isn't the same for everyone.

This looks like a motivating example for scoped_unlock. :-)


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