summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-10-31 09:54:50 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-10-31 09:54:50 +0100
commit4f67ade2dcac00d3807df19f18601ee2eb267818 (patch)
tree12073f6b43e6e532171fc5b215d2f131a6fa71c8
parent3e3f30d88dd33fc1a9859fa59912cd66dd66437d (diff)
downloadvdr-4f67ade2dcac00d3807df19f18601ee2eb267818.tar.gz
vdr-4f67ade2dcac00d3807df19f18601ee2eb267818.tar.bz2
Now calling pthread_cond_broadcast() in the desctructor of cCondWait and cCondVar; using pthread_cond_broadcast() instead of pthread_cond_signal() in cCondWait
-rw-r--r--HISTORY4
-rw-r--r--thread.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index dbe592ee..6f802d9c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3089,3 +3089,7 @@ Video Disk Recorder Revision History
- Immediately displaying the new channel info when switching channel groups.
- Moved the main program loop variables further up to allow compilation with
older compiler versions (thanks to Marco Schlüßler for reporting this one).
+- Now calling pthread_cond_broadcast() in the desctructor of cCondWait and
+ cCondVar to make sure any sleepers will wake up (suggested by Werner Fink).
+ Also using pthread_cond_broadcast() instead of pthread_cond_signal() in
+ cCondWait, in case there is more than one sleeper.
diff --git a/thread.c b/thread.c
index 144563df..080be0e0 100644
--- a/thread.c
+++ b/thread.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.c 1.35 2004/10/24 11:05:56 kls Exp $
+ * $Id: thread.c 1.36 2004/10/31 09:54:02 kls Exp $
*/
#include "thread.h"
@@ -28,6 +28,7 @@ cCondWait::cCondWait(void)
cCondWait::~cCondWait()
{
+ pthread_cond_broadcast(&cond); // wake up any sleepers
pthread_cond_destroy(&cond);
pthread_mutex_destroy(&mutex);
}
@@ -71,7 +72,7 @@ void cCondWait::Signal(void)
{
pthread_mutex_lock(&mutex);
signaled = true;
- pthread_cond_signal(&cond);
+ pthread_cond_broadcast(&cond);
pthread_mutex_unlock(&mutex);
}
@@ -84,6 +85,7 @@ cCondVar::cCondVar(void)
cCondVar::~cCondVar()
{
+ pthread_cond_broadcast(&cond); // wake up any sleepers
pthread_cond_destroy(&cond);
}