InterprocessLockGetNamedMutex(String, Boolean) Method

Gets a uniquely named inter-process Mutex associated with the specified name that identifies a source object needing concurrency locking.

Definition

Namespace: Gemstone.Threading
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static Mutex GetNamedMutex(
	string name,
	bool global = true
)

Parameters

name  String
Identifying name of source object needing concurrency locking (e.g., a path and file name).
global  Boolean  (Optional)
Determines if mutex should be marked as global; set value to false for local.

Return Value

Mutex
A uniquely named inter-process Mutex specific to name; Mutex is created if it does not exist.

Remarks

This function uses a hash of the name when creating the Mutex, not the actual name - this way restrictions on the name length do not need to be a user concern. All processes needing an inter-process Mutex need to use this same function to ensure access to the same Mutex.

The name can be a string of any length (must not be empty, null or white space) and is not case-sensitive. All hashes of the name used to create the global Mutex are first converted to lower case.

Exceptions

ArgumentNullExceptionArgument name cannot be empty, null or white space.
UnauthorizedAccessExceptionThe named mutex exists, but the user does not have the minimum needed security access rights to use it.

See Also