Class AppMutex
Provides a cross-process object allowing easy detection of application instances (e.g., for use by installers and update tools). No-op on non-Windows platforms.
Namespace: NanoByte.Common.Native
Assembly: NanoByte.Common.dll
Syntax
public sealed class AppMutex : Object
Remarks
Constructors
AppMutex()
Declaration
public AppMutex()
Methods
Create(String)
Creates or opens a mutex to signal that an application is running.
Declaration
public static AppMutex Create(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name to be used as a mutex identifier. |
Returns
Type | Description |
---|---|
AppMutex | The handle for the mutex. Can be used to close it again. Will automatically be released once the process terminates. |
Dispose()
Closes the mutex handle, allowing it to be released if no other instances are running.
Declaration
public void Dispose()
Probe(String)
Checks whether a specific mutex exists (local or global) without opening a lasting handle.
Declaration
public static bool Probe(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name to be used as a mutex identifier. |
Returns
Type | Description |
---|---|
Boolean |
|