Originally Posted by
brewbuck
If you find yourself wanting to obtain the value of a semaphore, you should be thinking "I'm about to create a bug."
There is no such thing as "the value of a semaphore." By the time you've read the value, the value may have changed. It is inherently wrong. Semaphores are waited upon, and signaled. That's it.