Semaphores values
问题 I have a question regarding using Semaphores HANDLE WINAPI CreateSemaphore(...); Is there anyway I can get the current value of the semaphore? 回答1: No, and that's intentional. Even if you could get the "current" value, that value might very well have changed before you could do anything with it. The only way to do anything with it is to get and set the value atomically -- e.g., wait for the semaphore to be free and set it to "owned" (by that piece of code) in the same operation. 回答2: Here the