RtkReleaseSemaphore

RtkReleaseSemaphore increases the count of the specified semaphore object by a specified amount.

Syntax

Copy
NTSTATUS RTKAPI RtkReleaseSemaphore(
    [in]    RTSSINST RtssInst,
    [in]    HANDLE SemaphoreHandle,
    [in]    LONG ReleaseCount,
    [out]   PLONG PreviousCount
);

Parameters

[in] RtssInst

An RTSSINST value returned from a call to RtkRtssAttach or RtkRtssAttachEx. Pass a valid RTSSINST value, or the call will fail with STATUS_INVALID_PARAMETER.

[in] SemaphoreHandle

The handle that identifies the sempahore object is returned by a preceding call to RtkCreateSemaphore or RtkOpenSemaphore.

[in] ReleaseCount

The amount the semaphore object's current count is to be increased. The value must be greater than zero. If the specified amount would cause the semaphore's count to exceed the maximum count specified when the semaphore was created, the count is not changed, and the function returns STATUS_SEMAPHORE_LIMIT_EXCEEDED.

[out] PreviousCount

A pointer to a variable receives the previous count for the semaphore. This parameter can be NULL if the last count is not required.

Return Value

If the function succeeds, it returns STATUS_SUCCESS. If the function fails, it returns one of the following NTSTATUS error codes:

Remarks

The state of a semaphore object is signaled when its count is greater than zero and non-signaled when its count is equal to zero. The process that calls RtkCreateSemaphore specifies the semaphore's initial count. Each time a waiting thread is released because of the semaphore's signaled state, the semaphore count is decreased by one.

Requirements

Minimum supported version Header Library

IRQL

wRTOS 1.0 SDK

RtkApi.h

RtkApi_W64.lib

PASSIVE_LEVEL

See Also: