I have a question regarding using Semaphores
HANDLE WINAPI CreateSemaphore(...);
Is there anyway I can get the current value of the semaphore?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.