System.Threading.Mutex.OpenExisting Method

Opens the specified named mutex, if it already exists.

Syntax

public static Mutex OpenExisting (string name)

Parameters

name
The name of the system mutex to open.

Returns

An object that represents the named system mutex.

Remarks

The erload:System.Threading.Mutex.OpenExisting method tries to open the specified named system mutex. If the system mutex does not exist, this method throws an exception instead of creating the system object. To create the system mutex when it does not already exist, use one of the Mutex.#ctor(bool, string) constructors that has a name parameter.

Multiple calls to this method that use the same value for name do not necessarily return the same System.Threading.Mutex object, even though the objects that are returned represent the same named system mutex.

This method overload is equivalent to calling the Mutex.OpenExisting(string, System.Security.AccessControl.MutexRights) method overload and specifying System.Security.AccessControl.MutexRights.Synchronize and System.Security.AccessControl.MutexRights.Modify rights, combined by using the bitwise OR operation.

Specifying the System.Security.AccessControl.MutexRights.Synchronize flag allows a thread to wait on the mutex, and specifying the System.Security.AccessControl.MutexRights.Modify flag allows a thread to call the Mutex.ReleaseMutex method.

This method does not request ownership of the mutex.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0