RtSemaphore.OpenExisting Method

Opens an existing named semaphore.

Namespace:  IntervalZero.MaxRT.wRTOS.RtApi.Threading
Assembly:  IntervalZero.MaxRT.wRTOS (in IntervalZero.MaxRT.wRTOS.dll) Version: 1.0.0.0 (File version: 1.0.1)

Syntax

Copy
public static RtSemaphore OpenExisting(
    string name
)

Parameters

name

Type: System.String
The name of a system semaphore.

Return Value

Type: RtSemaphore
A Semaphore object that represents a named system semaphore.

Exceptions

Exception Condition

ArgumentException

Name is a zero-length string. -or- name is longer than 260 characters.

ArgumentNullException

Name is a null reference (Nothing in Visual Basic).

WaitHandleCannotBeOpenedException

The named semaphore does not exist.

Remarks

The OpenExisting method attempts to open only existing named semaphores. If a system semaphore with the specified name does not exist, this method throws an exception instead of creating the system semaphore. It is possible to create multiple Semaphore objects that represent the same named system semaphore. Two calls to this method with the same value for name do not necessarily return the same Semaphore object, even though the objects returned both represent the same named system semaphore.

See Also: