INtime SDK Help
ReleaseRtSemaphore
INtime SDK v7 > About INtime > INtime Kernel > Semaphores > ReleaseRtSemaphore

Releases a given number of units to a semaphore.

A thread does not have to wait for a unit from a semaphore to release a unit to it.

When a thread releases units to a semaphore, and no thread of equal or higher priority waits, the thread remains running. If a higher priority thread is waiting for the unit, it preempts the lower priority thread.

The semaphore returns an E_LIMIT condition code when:

BOOLEAN ReleaseRtSemaphore(
    RTHANDLE hSemaphore,    // handle for RT semaphore
    WORD wReleaseCount      // number of units to release to semaphore
);

Parameters

hSemaphore
Handle for a RT semaphore.
wReleaseCount
Number of units to release to the semaphore.

Remarks

If the transmission would cause the semaphore to exceed its maximum allowable supply, an E_LIMIT status code occurs. Otherwise, the transmission is successful and the system tries to satisfy the requests of the threads in the semaphore's thread queue, beginning at the head of the queue.

Return Values

TRUE
Success.
FALSE
Failure. To determine the status, call GetLastRtError.

Status

E_OK 0x0000
No exceptional conditions occurred.
E_LIMIT 0x0004
The calling thread wants to release more units than the semaphore can receive.
E_EXIST 0x0006
You used an invalid value for hSemaphore.
E_TYPE 0x8002
hSemaphore is not a handle for a semaphore.
E_INVALID_ADDRESS 0x00E2
The address provided for the remote object is not a valid address.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also

Semaphore system calls, CreateRtSemaphore