title: Is there a way to find out the current count of a win32 semaphore?
body: <p>I'm looking for a way with no side effects.  </p>
  
  <p>Ideally, the following code would do the trick:  </p>
  
  <pre><code>long currentCount = 0;  
  ::ReleaseSemaphore(h, 0, &amp;currentCount);  
  </code></pre>
  
  <p>But unfortunately 0 is not allowed as the value of lReleaseCount, so the call returns FALSE.  </p>