Skip to content
Snippets Groups Projects
Commit cd323a34 authored by rswindell's avatar rswindell
Browse files

Only clear semaphores (when appropriate) in RingBufRead.

parent 0952625b
No related branches found
No related tags found
No related merge requests found
......@@ -135,13 +135,6 @@ DWORD RINGBUFCALL RingBufFull( RingBuf* rb )
else
retval = rb->size - (tail - head);
#ifdef RINGBUF_SEM
if(retval==0) /* empty */
sem_reset(&rb->sem);
if(retval<rb->highwater_mark)
sem_reset(&rb->highwater_sem);
#endif
#ifdef RINGBUF_MUTEX
pthread_mutex_unlock(&rb->mutex);
#endif
......@@ -256,7 +249,10 @@ DWORD RINGBUFCALL RingBufRead( RingBuf* rb, BYTE* dst, DWORD cnt )
rb->pTail = rb->pStart;
#ifdef RINGBUF_SEM /* clear semaphores, if appropriate */
RingBufFull( rb );
if(len-cnt==0) /* empty */
sem_reset(&rb->sem);
if(len-cnt<rb->highwater_mark)
sem_reset(&rb->highwater_sem);
#endif
#ifdef RINGBUF_MUTEX
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment