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

Does one of these:

DWORD WaitForRtSemaphore(
    RTHANDLE hSemaphore,     // handle for RT semaphore
    WORD wCount,            // number of units to wait for
    DWORD dwMilliseconds    // number of milliseconds to wait for units
);

Parameters

hSemaphore
Handle for an RT semaphore.
wCount
Number of units the calling thread requests. To find out how many units are available, specify 0 (zero).
dwMilliseconds
The number of milliseconds the calling thread waits:
NO_WAIT The thread does not wait.
WAIT_FOREVER The thread waits for its request to be fully satisfied.
1-655349 Calling thread goes to sleep for this many milliseconds, after which it awakes.

Note: The kernel converts milliseconds to high-level ticks.

Remarks

You can specify the amount of time a thread that uses WaitForRtSemaphore waits for a semaphore unit. Two factors determine whether the thread receives the units and how soon: how many units the thread asks for, and where the thread is in the queue.

Return Values

The number of units remaining on the semaphore.
Success.
WAIT_FAILED
Failure. To determine the status, call GetLastRtError.

Status

E_OK 0x0000
No exceptional conditions occurred.
E_TIME 0x0001
No units were available during the waiting period specified in dwMilliseconds.
E_LIMIT 0x0004
wCount contains a value greater than the maximum value specified for the semaphore when it was created.
E_EXIST 0x0006
You used an invalid value for hSemaphore.
E_TYPE 0x8002
hSemaphore requires an RT handle for a semaphore.
E_PARAM 0x8004
dwMilliseconds contains an invalid value.
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