Training
×

Releasing and Waiting for Units

If the number of units specified in the ReleaseRtSemphore call would cause the semaphore to exceed the maximum specified when it was created, the thread will receive an E_LIMIT exception code. Similarly, if the number of units requested with a WaitForRtSemaphore is greater than the maximum, the thread will receive an E_LIMIT exception code.
With WaitForRtSemaphore, if the requested number of units are available, the requesting thread will remain running and receive the units. The thread at the head of the queue must have its request fulfilled first, even if enough units are available for the request of another thread elsewhere in the queue.