NanoByte.Common  2.7.0
NanoByte.Common.Native.WindowsMutex Class Reference

Provides Windows-specific API calls for cross-process Mutexes. More...

Static Public Member Functions

static IntPtr Create ([Localizable(false)] string name, out bool alreadyExists)
 Creates a new (or opens an existing) mutex. More...
 
static bool Probe ([Localizable(false)] string name)
 Checks whether a specific mutex exists without opening a lasting handle. More...
 
static void Close (IntPtr handle)
 Closes an existing mutex handle. The mutex is destroyed if this is the last handle. More...
 

Detailed Description

Provides Windows-specific API calls for cross-process Mutexes.

Member Function Documentation

◆ Close()

static void NanoByte.Common.Native.WindowsMutex.Close ( IntPtr  handle)
inlinestatic

Closes an existing mutex handle. The mutex is destroyed if this is the last handle.

Parameters
handleThe mutex handle to be closed.
Exceptions
PlatformNotSupportedExceptionThis method is called on a platform other than Windows.

◆ Create()

static IntPtr NanoByte.Common.Native.WindowsMutex.Create ( [Localizable(false)] string  name,
out bool  alreadyExists 
)
inlinestatic

Creates a new (or opens an existing) mutex.

Parameters
nameThe name to be used as a mutex identifier.
alreadyExiststrue if an existing mutex was opened; false if a new one was created.
Returns
The handle for the mutex. Can be used in Close. Will automatically be released once the process terminates.
Exceptions
Win32ExceptionThe native subsystem reported a problem.
PlatformNotSupportedExceptionThis method is called on a platform other than Windows.

◆ Probe()

static bool NanoByte.Common.Native.WindowsMutex.Probe ( [Localizable(false)] string  name)
inlinestatic

Checks whether a specific mutex exists without opening a lasting handle.

Parameters
nameThe name to be used as a mutex identifier.
Returns
true if an existing mutex was found; false if none existed.
Exceptions
Win32ExceptionThe native subsystem reported a problem.
PlatformNotSupportedExceptionThis method is called on a platform other than Windows.

The documentation for this class was generated from the following file: