- if(atomic_dec_return(<t_buf->writer_futex) >= 0) {
- /* non contended */
- } else {
- /* We block until the reader unblocks us */
- atomic_set(<t_buf->writer_futex, -1);
- /* We block until the reader tells us to wake up.
- Signals will simply cause this loop to restart.
- */
- do {
- ret = futex((unsigned long)<t_buf->writer_futex,
- FUTEX_WAIT, -1, 0, 0, 0);
- } while(ret != 0 && ret != EWOULDBLOCK);
- }