ID: Q94997
4.00 | 3.10 3.50 3.51 4.00
WINDOWS | WINDOWS NT
kbprg
The information in this article applies to:
- Microsoft Windows NT versions 3.1, 3.5, 3.51, and 4.0
- Microsoft Windows 95 version 4.0
ReleaseSemaphore(), which increments the count of a given semaphore object by a specified amount, will not take a negative value.
If, for some reason, you want to reduce the number of available semaphore "slots" to temporarily restrict or reduce access, you may loop calling WaitForSingleObject() with a zero timeout, counting the number of times it succeeds. When you no longer need to hold the semaphore slots, call ReleaseSemaphore() with the number of slots counted.
Note that this method does not prevent other threads from taking a semaphore slot when your thread is looping.
Additional reference words: 3.10 3.50 3.51 4.00 95 KBCategory: kbprg KBSubcategory: BseMisc BseSync
Keywords : kbnokeyword kbKernBase kbThread kbGrpKernBase
Version : 4.00 | 3.10 3.50 3.51 4.00
Platform : NT WINDOWS
Last Reviewed: December 18, 1996