InterprocessLockGetNamedMutex(Boolean) Method

Gets a uniquely named inter-process Mutex associated with the running application, typically used to detect whether an instance of the application is already running.

Definition

Namespace: Gemstone.Threading
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static Mutex GetNamedMutex(
	bool perUser
)

Parameters

perUser  Boolean
Indicates whether to generate a different name for the Mutex dependent upon the user running the application.

Return Value

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

Remarks

This function uses a hash of the assembly's GUID when creating the Mutex, if it is available. If it is not available, it uses a hash of the simple name of the assembly. Although the name is hashed to help guarantee uniqueness, it is still entirely possible that another application may use that name with the same hashing algorithm to generate its Mutex name. Therefore, it is best to ensure that the GuidAttribute is defined in the AssemblyInfo of your application.

Exceptions

UnauthorizedAccessExceptionThe named mutex exists, but the user does not have the minimum needed security access rights to use it.

See Also