utility: use non throwing try_lock approach when creating named mutex for shared memory

This commit is contained in:
Eberhard Graether
2017-05-05 16:31:51 +02:00
parent 8f44ad4a47
commit 562e623930
@@ -104,8 +104,7 @@ SharedMemory::SharedMemory(const std::string& name, size_t initialMemorySize, Ac
if (unlockMutex)
{
boost::interprocess::named_mutex mutex(boost::interprocess::open_only, getMutexName().c_str());
mutex.try_lock();
mutex.unlock();
boost::interprocess::scoped_lock<boost::interprocess::named_mutex> lock(mutex, boost::interprocess::try_to_lock);
}
}