Peter Dimov wrote:
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. :-)

Yes, I've long wanted that. Particularly when the second "do some more" involves a "long" operation that you don't want to hold the lock while it is pending.


--
Jon Biggar
Floorboard Software
[EMAIL PROTECTED]
[EMAIL PROTECTED]


_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to