diff options
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index 6913c71f..770b7c34 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -7,7 +7,7 @@ * Parts of this file were inspired by the 'ringbuffy.c' from the * LinuxDVB driver (see linuxtv.org). * - * $Id: ringbuffer.c 1.15 2003/04/27 09:54:32 kls Exp $ + * $Id: ringbuffer.c 1.16 2003/05/11 09:47:56 kls Exp $ */ #include "ringbuffer.h" @@ -31,30 +31,6 @@ cRingBuffer::~cRingBuffer() dsyslog("buffer stats: %d (%d%%) used", maxFill, maxFill * 100 / (size - 1)); } -void cRingBuffer::WaitForPut(void) -{ - putMutex.Lock(); - readyForPut.TimedWait(putMutex, 1000); - putMutex.Unlock(); -} - -void cRingBuffer::WaitForGet(void) -{ - getMutex.Lock(); - readyForGet.TimedWait(getMutex, 10); - getMutex.Unlock(); -} - -void cRingBuffer::EnablePut(void) -{ - readyForPut.Broadcast(); -} - -void cRingBuffer::EnableGet(void) -{ - readyForGet.Broadcast(); -} - // --- cRingBufferLinear ----------------------------------------------------- cRingBufferLinear::cRingBufferLinear(int Size, int Margin, bool Statistics) @@ -92,8 +68,6 @@ void cRingBufferLinear::Clear(void) head = tail = margin; lastGet = -1; Unlock(); - EnablePut(); - EnableGet(); } int cRingBufferLinear::Put(const uchar *Data, int Count) @@ -135,9 +109,6 @@ int cRingBufferLinear::Put(const uchar *Data, int Count) else Count = 0; Unlock(); - EnableGet(); - if (Count == 0) - WaitForPut(); } return Count; } @@ -163,8 +134,6 @@ uchar *cRingBufferLinear::Get(int &Count) Count = lastGet = cont; } Unlock(); - if (!p) - WaitForGet(); return p; } @@ -177,7 +146,6 @@ void cRingBufferLinear::Del(int Count) if (tail >= Size()) tail = margin; Unlock(); - EnablePut(); } else esyslog("ERROR: invalid Count in cRingBufferLinear::Del: %d", Count); @@ -228,8 +196,6 @@ void cRingBufferFrame::Clear(void) while ((p = Get()) != NULL) Drop(p); Unlock(); - EnablePut(); - EnableGet(); } bool cRingBufferFrame::Put(cFrame *Frame) @@ -246,7 +212,6 @@ bool cRingBufferFrame::Put(cFrame *Frame) } currentFill += Frame->Count(); Unlock(); - EnableGet(); return true; } return false; @@ -284,7 +249,6 @@ void cRingBufferFrame::Drop(cFrame *Frame) esyslog("ERROR: attempt to drop wrong frame from ring buffer!"); } Unlock(); - EnablePut(); } int cRingBufferFrame::Available(void) |