title: How to wait/block until a semaphore value reaches 0 in windows
body: <p>Using the semop() function on unix, it's possible to provide a sembuf struct with sem_op =0.  Essentially this means that the calling process will wait/block until the semaphore's value becomes zero.  Is there an equivalent way to achieve this in windows?</p>
  
  <p>The specific use case I'm trying to implement is to wait until the number of readers reaches zero before letting a writer write.  (yes, this is a somewhat unorthodox way to use semaphores; it's because there is no limit to the number of readers and so there's no set of constrained resources which is what semaphores are typically used to manage)</p>
  
  <p>Documentation on unix semop system call can be found here:
  <a href="http://codeidol.com/unix/advanced-programming-in-unix/Interprocess-Communication/-15.8.-Semaphores/" rel="nofollow noreferrer">http://codeidol.com/unix/advanced-programming-in-unix/Interprocess-Communication/-15.8.-Semaphores/</a></p>