title: Win32 Named mutex not released when process crashes
body: <p>I have 2 processes (A, B) sharing the same mutex (using WaitForSingleObject / ReleaseMutex calls). Everything works fine, but when process A crashes, process B is humming along happily. When I restart process A, there's a deadlock.</p>
  
  <p>Deeper investigation reveals that process B can successfully call ReleaseMutex() twice after process A crashes. </p>
  
  <p>My interpretation: After process A crashes, the mutex is still locked, but ownership of the mutex transfers readily to process B (which is a bug). That's why it's humming along happily, calling WaitForSingleObject (getting WAIT_OBJECT_0 in return) and ReleaseMutex (getting TRUE in return). </p>
  
  <p>Is it possible to use a named synchronization primitive similar to Mutex in such a way that a crash in process A will release the mutex? </p>
  
  <p>One solution is to use SEH and catch the crash and release mutex, but I really hope Windows has a robust primitive that doesn't deadlock like that on process crash.</p>