summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-12-24 15:37:11 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-12-24 15:37:11 +0100
commitf97b1069c6bdf519fd32280b35ed66abe6c02bde (patch)
treecc2d570d206287b26bb46631f298f70ca42b46d5 /device.c
parentc49253824a46a45dac86d2a0404b9d5c6e1a92a4 (diff)
downloadvdr-f97b1069c6bdf519fd32280b35ed66abe6c02bde.tar.gz
vdr-f97b1069c6bdf519fd32280b35ed66abe6c02bde.tar.bz2
Added cDevice::mutexReceiver to avoid a race condition when attaching/detaching receivers from different threads
Diffstat (limited to 'device.c')
-rw-r--r--device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/device.c b/device.c
index 7c8d97cd..2df50dab 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.63 2004/12/17 13:51:44 kls Exp $
+ * $Id: device.c 1.64 2004/12/24 15:37:11 kls Exp $
*/
#include "device.h"
@@ -990,6 +990,7 @@ bool cDevice::AttachReceiver(cReceiver *Receiver)
esyslog("ERROR: device %d has no lock, can't attach receiver!", CardIndex() + 1);
return false;
}
+ cMutexLock MutexLock(&mutexReceiver);
for (int i = 0; i < MAXRECEIVERS; i++) {
if (!receiver[i]) {
for (int n = 0; n < MAXRECEIVEPIDS; n++) {
@@ -1017,6 +1018,7 @@ void cDevice::Detach(cReceiver *Receiver)
if (!Receiver || Receiver->device != this)
return;
bool receiversLeft = false;
+ cMutexLock MutexLock(&mutexReceiver);
for (int i = 0; i < MAXRECEIVERS; i++) {
if (receiver[i] == Receiver) {
Receiver->Activate(false);