NanoByte.Common
Public Member Functions | Static Public Member Functions | List of all members
NanoByte.Common.AppMutex Class Reference

Provides a cross-process object allowing easy detection of application instances (e.g., for use by installers and update tools). May be a no-op on some platforms. More...

Public Member Functions

void Close ()
 Closes the mutex handle, allowing it to be released if no other instances are running. More...
 

Static Public Member Functions

static AppMutex Create ([NotNull, Localizable(false)] string name)
 Creates or opens a mutex to signal that an application is running. More...
 
static bool Probe ([NotNull, Localizable(false)] string name)
 Checks whether a specific mutex exists (local or global) without opening a lasting handle. More...
 

Detailed Description

Provides a cross-process object allowing easy detection of application instances (e.g., for use by installers and update tools). May be a no-op on some platforms.

Use Mutex or

See also
MutexLock

instead for synchronizing access to shared resources.

Member Function Documentation

◆ Close()

void NanoByte.Common.AppMutex.Close ( )
inline

Closes the mutex handle, allowing it to be released if no other instances are running.

◆ Create()

static AppMutex NanoByte.Common.AppMutex.Create ( [NotNull, Localizable(false)] string  name)
inlinestatic

Creates or opens a mutex to signal that an application is running.

Parameters
nameThe name to be used as a mutex identifier.
Returns
The handle for the mutex. Can be used to Close it again. Will automatically be released once the process terminates.

◆ Probe()

static bool NanoByte.Common.AppMutex.Probe ( [NotNull, Localizable(false)] string  name)
inlinestatic

Checks whether a specific mutex exists (local or global) 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.

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