System.Threading.Mutex.OpenExisting Method

Opens the specified named mutex, if it already exists, with the desired security access.

Syntax

public static Mutex OpenExisting (string name, System.Security.AccessControl.MutexRights rights)

Parameters

name
The name of the system mutex to open.
rights
A bitwise combination of the enumeration values that represent the desired security access.

Returns

An object that represents the named system mutex.

Remarks

The rights parameter must include the System.Security.AccessControl.MutexRights.Synchronize flag to allow threads to wait on the mutex, and the System.Security.AccessControl.MutexRights.Modify flag to allow threads to call the Mutex.ReleaseMutex method.

The erload:System.Threading.Mutex.OpenExisting method tries to open an existing named 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 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