This class is an interface to the user-mode semaphore services and provides tools for synchronizing access to shared resources. One can use ilSemaphore to coordinate the way parallel threads of execution access shared memory and other shared resources.
Semaphores take a nonnegative integer value.
A positive semaphore value corresponds to a free lock in that it does not obstruct the continued execution of a thread. A zero-valued semaphore corresponds to a set lock in that it suspends or blocks the continued execution of a thread. The thread remains blocked until another thread increments the semaphore counter value. If the semaphore counter was positive before the P operation, the thread uses the resource. If the value of the semaphore counter is zero when the P operation is attempted, the system suspends the thread until the semaphore counter is incremented by another thread performing a V operation.