Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-07-29 11:53:44


Christian Henning wrote:
> Hi there, I'm converting over our codebase to make use of the boost
> libs. Is there a way to manually lock and unlock a boost:mutex? Or, is
> there a conditional lock available? I know there is
> boost::mutex::scoped_lock that does it automatically.
>
> Here is code example that, I think, requires manual locking:
>
> void foo()
> {
>
> if( condition )
> oMutex.lock;
>
> do something
>
>
> if( condition )
> oMutex.unlock;
>
> }

void foo()
{
    mutex::scoped_lock lock( oMutex, condition );
    // do something
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net