title: Circular-/Ring-Buffer with blocking read and non-blocking write?
body: <p>I am searching for a ringbuffer-implementation in C in userspace, so I can use it in my library.</p>
  
  <p>Because I need a ringbuffer with</p>
  
  <ul>
  <li>non-blocked write (=overwrite oldest data)</li>
  <li>blocked read if empty</li>
  </ul>
  
  <p>I searched a while and remembered I have used <code>wait_event_interruptible</code> &amp; <code>wake_up_interruptible</code> to do something like this in kernel-mode.</p>
  
  <p>But what is used in user-space so I maybe can search for a ringbuffer in combination with that method? I don't want to re-invent the wheel - there are many ringbuffer-solutions around.</p>
  
  <p>Thanks in advance &amp; with kind regards!</p>
  
  <p>EDIT:</p>
  
  <p>It seems that maybe <code>pthread_cond_wait</code> could be an equivalent of <code>wait_event_interruptible</code>.</p>