I came across a situation where I need to replace BOOST scoped_lock with an equivalent in C ++ 11. Under visual studio 2013. Since C ++ 11 does not support scoped_lock, I'm not sure what the replacement code will be for the next one. Should I go for lock_guard or try_lock?
boost::mutex::scoped_lock objectLock(ObjectVectorMutex, boost::try_to_lock);
if(objectLock)
{
}
And in the code I have the following wait statement
if(ObjectsCollection.empty())
{
//This is where we wait till something is filled
MotionThreadCondition.wait(objectLock);
ElapsedTime = 0;
}
Any guidance is greatly appreciated.
source
share