INtime SDK Help
INtime SDK v7.1 > 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


Handle for an RT semaphore.
Number of units the calling thread requests. To find out how many units are available, specify 0 (zero).
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.


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.
Failure. To determine the status, call GetLastRtError.


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.
The address provided for the remote object is not a valid address.


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

See Also

Semaphore system calls