Requests a unit from the specified low-level semaphore.
BOOLEAN knWaitForRtSemaphore( KNHANDLE hSemaphore, // handle for low-level semaphore DWORD dwKernelTicks // the number of kernel clock intervals to wait );
hSemaphore
dwKernelTicks
Literal | Meaning |
---|---|
KN_DONT_WAIT |
The thread does not wait at all. |
KN_WAIT_FOREVER |
The thread waits indefinitely. |
UINT_32 value |
The thread waits for the specified number of clock ticks. |
If the semaphore currently contains units, the number of units is reduced by 1 and the thread proceeds. If the semaphore has no units and the thread is willing to wait, the thread is put to sleep and placed into the semaphore's thread queue. The thread will be awakened by one of these events:
Note: This is a blocking call; do not use it in an interrupt handler.
TRUE
FALSE
E_OK
E_KN_TIME_OUT
E_KN_NONEXIST
Note: Delete semaphores only after a thread begins waiting. This call cannot return control to the calling thread if its corresponding semaphore is already deleted.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/rtbase.h | rt.h | rt.lib |
Semaphore system calls, CopyRtSystemInfo, knReleaseRtSemaphore