Skip to content

Commit

Permalink
fixed CrossProcessMutex for Access Denied case
Browse files Browse the repository at this point in the history
  • Loading branch information
frankseide committed Feb 2, 2016
1 parent 3fce4a8 commit 6d7c13a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/Common/CrossProcessMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ class CrossProcessMutex
assert(m_handle == NULL);
m_handle = ::CreateMutexA(NULL /*security attr*/, FALSE /*bInitialOwner*/, m_name.c_str());
if (m_handle == NULL)
RuntimeError("Acquire: Failed to create named mutex %s: %d.", m_name.c_str(), GetLastError());
{
if (!wait)
return false; // can't lock due to access permissions: lock already exists, consider not available
else
RuntimeError("Acquire: Failed to create named mutex %s: %d.", m_name.c_str(), GetLastError());
}

if (::WaitForSingleObject(m_handle, wait ? INFINITE : 0) != WAIT_OBJECT_0)
{
Expand Down

0 comments on commit 6d7c13a

Please sign in to comment.