summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-08-03 14:18:08 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-08-03 14:18:08 +0200
commitbff17fb1d0e39583e44ba93ea214d7434ecef2ce (patch)
treedf3c64f93c4a572feca8de742f2300bfa0f687ee /thread.c
parent1962940c39c1951bd107f63d2e071df58ba0b125 (diff)
downloadvdr-bff17fb1d0e39583e44ba93ea214d7434ecef2ce.tar.gz
vdr-bff17fb1d0e39583e44ba93ea214d7434ecef2ce.tar.bz2
Added support for replaying DVDs
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index e253ea04..63f104a3 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.9 2001/06/27 11:34:41 kls Exp $
+ * $Id: thread.c 1.10 2001/08/02 13:48:45 kls Exp $
*/
#include "thread.h"
@@ -14,6 +14,40 @@
#include <unistd.h>
#include "tools.h"
+// --- cCondVar --------------------------------------------------------------
+
+cCondVar::cCondVar(void)
+{
+ pthread_cond_init(&cond, 0);
+}
+
+cCondVar::~cCondVar()
+{
+ pthread_cond_destroy(&cond);
+}
+
+bool cCondVar::Wait(cMutex &_mutex)
+{
+ return pthread_cond_wait(&cond, &_mutex.mutex);
+}
+
+/*
+bool cCondVar::TimedWait(cMutex &_mutex, unsigned long tmout)
+{
+ return pthread_cond_timedwait(&cond, &_mutex.mutex, tmout);
+}
+*/
+
+void cCondVar::Broadcast(void)
+{
+ pthread_cond_broadcast(&cond);
+}
+
+void cCondVar::Signal(void)
+{
+ pthread_cond_signal(&cond);
+}
+
// --- cMutex ----------------------------------------------------------------
cMutex::cMutex(void)
@@ -85,6 +119,7 @@ bool cThread::Start(void)
running = true;
parentPid = getpid();
pthread_create(&thread, NULL, (void *(*) (void *))&StartThread, (void *)this);
+ pthread_setschedparam(thread, SCHED_RR, 0);
usleep(10000); // otherwise calling Active() immediately after Start() causes a "pure virtual method called" error
}
return true; //XXX return value of pthread_create()???