我可以在超出scoped_lock范围之前解锁互斥锁吗?我怎么能这样做?
{boost::mutex::scoped_lock lock(mutex);
if(conditionaA)
{
if(conditionB)
{
//could I unlock here as I don't want to hold the lock too long.
//perform calculation
}
}
else
{
}
}//lock scope
Run Code Online (Sandbox Code Playgroud)
谢谢.