Questions tagged [abandonedmutexexception]

An exception that is thrown when one thread acquires a Mutex object that another thread has abandoned by exiting without releasing it.

An exception that is thrown when one thread acquires a Mutex object that another thread has abandoned by exiting without releasing it. (Source: MSDN Documentation)

5 questions
22
votes
1 answer

How to gracefully get out of AbandonedMutexException?

I use the following code to synchronize mutually exclusive access to a shared resource between several running processes. The mutex is created as such: Mutex mtx = new Mutex(false, "MyNamedMutexName"); Then I use this method to enter mutually…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
13
votes
2 answers

Abandoned mutex exception

I am trying to use a mutex for the first time and have the following code executing on two separate instances of the program public void asynchronousCode() { using (var mutex = new Mutex(false, "mySpecialMutex")) { if…
1
vote
1 answer

Why don't named .NET mutexes throw AbandonedMutexException when disposed?

I don't understand why the .NET mutex does not either throw an AbandonedMutexException in one of the waiting threads or release the mutex when Mutex.Dispose() is called. In particular, code like this will deadlock: public static void testCall() { …
Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
0
votes
1 answer

C# Mutex handling

I am not sure to have well understood how to handle mutex. I need that a process run only once, but if for any reason it crash or close unexpectedly, i also need to reset the abandoned mutex. For that reason i made an helper calls that try to…
Skary
  • 1,322
  • 1
  • 13
  • 40
0
votes
0 answers

Windows auto release mutex when process crash

I use global mutex in multi-process in windows, however, the mutex won't be released when the owner process crashes, and then another process calls WaitForSingleObject, it returns WAIT_ABANDONED, how should I do to let this mutex relase, or do some…