Class WindowsMutex
Provides Windows-specific API calls for cross-process Mutexes.
public static class WindowsMutex
- Inheritance
-
objectWindowsMutex
Methods
Close(IntPtr)
Closes an existing mutex handle. The mutex is destroyed if this is the last handle.
public static void Close(IntPtr handle)
Parameters
handle
IntPtrThe mutex handle to be closed.
Exceptions
- PlatformNotSupportedException
This method is called on a platform other than Windows.
Create(string, out bool)
Creates a new (or opens an existing) mutex.
public static IntPtr Create(string name, out bool alreadyExists)
Parameters
name
stringThe name to be used as a mutex identifier.
alreadyExists
booltrue
if an existing mutex was opened;false
if a new one was created.
Returns
- IntPtr
The handle for the mutex. Can be used in Close(IntPtr). Will automatically be released once the process terminates.
Exceptions
- Win32Exception
The native subsystem reported a problem.
- PlatformNotSupportedException
This method is called on a platform other than Windows.
Probe(string)
Checks whether a specific mutex exists without opening a lasting handle.
public static bool Probe(string name)
Parameters
name
stringThe name to be used as a mutex identifier.
Returns
- bool
true
if an existing mutex was found;false
if none existed.
Exceptions
- Win32Exception
The native subsystem reported a problem.
- PlatformNotSupportedException
This method is called on a platform other than Windows.