Decreases the internal count of the semaphore by one, blocking thread execution if the count would fall below zero. A blocked thread is resumed as soon as another thread calls SignalSemaphore().
Semaphore The semaphore to wait for.
The semaphore count is limited to a signed 32-bit value, so a maximum of 2147483647 WaitSemaphore() calls can be made without being balanced by SignalSemaphore() calls in between.
See CreateSemaphore() for a code example.