This documentation is archived and is not being maintained.

AbandonedMutexException Class

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

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

public class AbandonedMutexException extends SystemException

When a thread abandons a mutex, the exception is thrown in the next thread that acquires the mutex. The thread might acquire the mutex because it was already waiting on the mutex or because it enters the mutex at a later time.

An abandoned mutex indicates a serious programming error. When a thread exits without releasing the mutex, the data structures protected by the mutex might not be in a consistent state. Prior to version 2.0 of the .NET Framework, such problems were hard to discover because no exception was thrown if a wait completed as the result of an abandoned mutex. For more information, see the Mutex class.

The next thread to request ownership of the mutex can handle this exception and proceed, provided that the integrity of the data structures can be verified.

The following code example executes a thread that abandons five mutexes, demonstrating their effects on the WaitOne, WaitAny, and WaitAll methods. The value of the MutexIndex property is displayed for the WaitAny call.

NoteNote:

The call to the WaitAny method is interrupted by one of the abandoned mutexes. The other abandoned mutex could still cause an AbandonedMutexException to be thrown by subsequent wait methods.

No code example is currently available or this language may not be supported.

System.Object
  System.Exception
    System.SystemException
      System.Threading.AbandonedMutexException

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: