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
handleIntPtrThe 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
namestringThe name to be used as a mutex identifier.
alreadyExistsbooltrueif an existing mutex was opened;falseif 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
namestringThe name to be used as a mutex identifier.
Returns
- bool
trueif an existing mutex was found;falseif none existed.
Exceptions
- Win32Exception
The native subsystem reported a problem.
- PlatformNotSupportedException
This method is called on a platform other than Windows.