July 28, 2014
Releases the Mutex once.
Assembly: mscorlib (in mscorlib.dll)
A thread that owns a mutex can specify the same mutex in repeated wait function calls without blocking its execution. The number of calls is kept by the common language runtime. The thread must call the same number of times to release ownership of the mutex.
If a thread terminates while owning a mutex, the mutex is said to be abandoned. The state of the mutex is set to signaled and the next waiting thread gets ownership. In .NET for the desktop, if no one owns the mutex, the state of the mutex is signaled and an AbandonedMutexException is thrown in the next thread that acquires the mutex. This behavior is different for different versions of Windows Phone.
Windows Phone 8: In Windows Phone 8, an Exception is thrown in the next thread.
Windows Phone OS 7.1: In Windows Phone OS 7.1, no exception is thrown.
An abandoned mutex often indicates a serious error in the code. When a thread exits without releasing the mutex, the data structures protected by the mutex might not be in a consistent state. The next thread to request ownership of the mutex can handle this exception and proceed, if the integrity of the data structures can be verified.
In the case of a system-wide mutex, an abandoned mutex might indicate that an application has been terminated abruptly (for example, by using Windows Task Manager).