summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-01-16 14:50:33 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-01-16 14:50:33 +0100
commit8c0981583fcd5e531ac955cd8184866dd4eaf9a2 (patch)
tree5c828b6806e777e979666506a85fab8513db22b8
parentc522225344fdcbea2ec2946695d43a5dfa6c175a (diff)
downloadvdr-8c0981583fcd5e531ac955cd8184866dd4eaf9a2.tar.gz
vdr-8c0981583fcd5e531ac955cd8184866dd4eaf9a2.tar.bz2
Fixed a possible race condition in cDevice::Action() and cTSBuffer::Action()
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--device.c13
3 files changed, 10 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 74487594..987112f6 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -189,6 +189,7 @@ Stefan Huelswitt <huels@iname.com>
skin in case a shorter title is set after a longer one
for fixing handling of pmAudioOnlyBlack
for pointing out possible race conditions in handling childTid in cThread
+ for fixing a possible race condition in cDevice::Action() and cTSBuffer::Action()
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than
diff --git a/HISTORY b/HISTORY
index b4c148db..e6ac729b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3318,3 +3318,5 @@ Video Disk Recorder Revision History
cRecorder::cRecorder()
cReceiver::cReceiver()
cRemux::cRemux()
+- Fixed a possible race condition in cDevice::Action() and cTSBuffer::Action()
+ (thanks to Stefan Huelswitt).
diff --git a/device.c b/device.c
index 0bbf21ce..2cf9f0fd 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 1.74 2005/01/16 14:05:37 kls Exp $
+ * $Id: device.c 1.75 2005/01/16 14:48:52 kls Exp $
*/
#include "device.h"
@@ -991,8 +991,7 @@ bool cDevice::Receiving(bool CheckAny) const
void cDevice::Action(void)
{
- active = true;
- if (OpenDvr()) {
+ if (active && OpenDvr()) {
for (; active;) {
// Read data from the DVR device:
uchar *b = NULL;
@@ -1054,7 +1053,10 @@ bool cDevice::AttachReceiver(cReceiver *Receiver)
Receiver->device = this;
receiver[i] = Receiver;
Unlock();
- Start();
+ if (!active) {
+ active = true;
+ Start();
+ }
return true;
}
}
@@ -1094,10 +1096,10 @@ cTSBuffer::cTSBuffer(int File, int Size, int CardIndex)
SetDescription("TS buffer on device %d", CardIndex);
f = File;
cardIndex = CardIndex;
- active = false;
delivered = false;
ringBuffer = new cRingBufferLinear(Size, TS_SIZE, true, "TS");
ringBuffer->SetTimeouts(100, 100);
+ active = true;
Start();
}
@@ -1113,7 +1115,6 @@ void cTSBuffer::Action(void)
if (ringBuffer) {
bool firstRead = true;
cPoller Poller(f);
- active = true;
for (; active;) {
if (firstRead || Poller.Poll(100)) {
firstRead = false;