diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | ringbuffer.c | 7 | ||||
-rw-r--r-- | ringbuffer.h | 4 |
3 files changed, 10 insertions, 5 deletions
@@ -8882,7 +8882,7 @@ Video Disk Recorder Revision History - Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to Sergey Chernyavskiy). -2017-03-18: Version 2.3.3 +2017-03-19: Version 2.3.3 - Added 'S3W ABS-3A' to sources.conf (thanks to Frank Richter). - Fixed a possible deadlock in the recordings handler thread. @@ -8918,3 +8918,5 @@ Video Disk Recorder Revision History that is capable of decrypting more than one channel ("Multi Channel Decryption") to decrypt channels from different transponders. See the remarks in mtd.h on what a derived cCamSlot class needs to do in order to activate MTD. +- The function cRingBufferLinear::Clear() can now be called safely from the + reading thread, without additional locking. diff --git a/ringbuffer.c b/ringbuffer.c index d33a4719..902c8878 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 4.1 2016/12/22 10:26:13 kls Exp $ + * $Id: ringbuffer.c 4.2 2017/03/19 12:43:36 kls Exp $ */ #include "ringbuffer.h" @@ -216,9 +216,10 @@ int cRingBufferLinear::Available(void) void cRingBufferLinear::Clear(void) { - tail = head = margin; + int Head = head; + tail = Head; #ifdef DEBUGRINGBUFFERS - lastHead = head; + lastHead = Head; lastTail = tail; lastPut = lastGet = -1; #endif diff --git a/ringbuffer.h b/ringbuffer.h index 9699bbc8..746fc51e 100644 --- a/ringbuffer.h +++ b/ringbuffer.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ringbuffer.h 4.1 2016/12/22 10:26:13 kls Exp $ + * $Id: ringbuffer.h 4.2 2017/03/19 13:11:39 kls Exp $ */ #ifndef __RINGBUFFER_H @@ -80,6 +80,8 @@ public: virtual int Free(void) { return Size() - Available() - 1 - margin; } virtual void Clear(void); ///< Immediately clears the ring buffer. + ///< This function may safely be called from the reading thread without additional + ///< locking. If called from the writing thread, proper locking must be used. int Read(int FileHandle, int Max = 0); ///< Reads at most Max bytes from FileHandle and stores them in the ///< ring buffer. If Max is 0, reads as many bytes as possible. |