NamedSemaphoreTryOpenExisting Method

Opens the specified named semaphore, if it already exists, and returns a value that indicates whether the operation succeeded.

Definition

Namespace: Gemstone.Threading
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static bool TryOpenExisting(
	string name,
	out NamedSemaphore?? semaphore
)

Parameters

name  String
The unique name identifying the semaphore. This name is case-sensitive. Use a backslash (\\) to specify a namespace, but avoid it elsewhere in the name. On Unix-based systems, the name should conform to valid file naming conventions, excluding slashes except for an optional namespace backslash. The name length is limited to 250 characters after any optional namespace.
semaphore  NamedSemaphore
When this method returns, contains a NamedSemaphore object that represents the named semaphore if the call succeeded, or null if the call failed. This parameter is treated as uninitialized.

Return Value

Boolean
true if the named semaphore was opened successfully; otherwise, false. In some cases, false may be returned for invalid names.

Remarks

The name may be prefixed with Global\ or Local\ to specify a namespace. When the Global namespace is specified, the synchronization object may be shared with any processes on the system. When the Local namespace is specified, which is also the default when no namespace is specified, the synchronization object may be shared with processes in the same session. On Windows, a session is a login session, and services typically run in a different non-interactive session. On Unix-like operating systems, each shell has its own session. Session-local synchronization objects may be appropriate for synchronizing between processes with a parent/child relationship where they all run in the same session.

See Also