summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-10-27 13:23:06 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-10-27 13:23:06 +0200
commit17cdf085c70d435532416b5dbd90cb39beae9bac (patch)
tree2851200a8a13a1ec197db6ed9af451806d83254e
parentfd4d1f77f24171df6b4c3ac241c724c753d9abd4 (diff)
downloadvdr-17cdf085c70d435532416b5dbd90cb39beae9bac.tar.gz
vdr-17cdf085c70d435532416b5dbd90cb39beae9bac.tar.bz2
Removed the recursion stuff from cThread (cMutex already does this)
-rw-r--r--HISTORY1
-rw-r--r--thread.c33
-rw-r--r--thread.h12
3 files changed, 11 insertions, 35 deletions
diff --git a/HISTORY b/HISTORY
index da54c9a1..27fdea6d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -843,3 +843,4 @@ Video Disk Recorder Revision History
- Updated 'channels.conf' for the "Bundesliga" channels of Premiere World
(thanks to Helmut Schächner).
- Changed the tuning code to use FrontendInfo to detect the type of DVB card.
+- Removed the recursion stuff from cThread (cMutex already does this).
diff --git a/thread.c b/thread.c
index b51489ec..7e5b0ea7 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.15 2001/10/21 12:25:31 kls Exp $
+ * $Id: thread.c 1.16 2001/10/27 13:23:06 kls Exp $
*/
#include "thread.h"
@@ -99,8 +99,7 @@ cThread::cThread(void)
signalHandlerInstalled = true;
}
running = false;
- parentPid = threadPid = lockingPid = 0;
- locked = 0;
+ parentPid = threadPid = 0;
}
cThread::~cThread()
@@ -159,24 +158,6 @@ void cThread::Cancel(int WaitSeconds)
pthread_cancel(thread);
}
-bool cThread::Lock(void)
-{
- if (getpid() != lockingPid || !locked) {
- Mutex.Lock();
- lockingPid = getpid();
- }
- locked++;
- return true;
-}
-
-void cThread::Unlock(void)
-{
- if (!--locked) {
- lockingPid = 0;
- Mutex.Unlock();
- }
-}
-
void cThread::WakeUp(void)
{
kill(parentPid, SIGIO); // makes any waiting 'select()' call return immediately
@@ -228,17 +209,13 @@ bool cThreadLock::Lock(cThread *Thread)
{
if (Thread && !thread) {
thread = Thread;
- locked = Thread->Lock();
- return locked;
+ Thread->Lock();
+ locked = true;
+ return true;
}
return false;
}
-bool cThreadLock::Locked(void)
-{
- return locked;
-}
-
// --- cPipe -----------------------------------------------------------------
// cPipe::Open() and cPipe::Close() are based on code originally received from
diff --git a/thread.h b/thread.h
index 89dcdf85..4547adde 100644
--- a/thread.h
+++ b/thread.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.h 1.10 2001/10/20 10:25:19 kls Exp $
+ * $Id: thread.h 1.11 2001/10/27 13:22:20 kls Exp $
*/
#ifndef __THREAD_H
@@ -45,9 +45,8 @@ class cThread {
friend class cThreadLock;
private:
pthread_t thread;
- cMutex Mutex;
- pid_t parentPid, threadPid, lockingPid;
- int locked;
+ cMutex mutex;
+ pid_t parentPid, threadPid;
bool running;
static time_t lastPanic;
static int panicLevel;
@@ -55,8 +54,8 @@ private:
static bool signalHandlerInstalled;
static void SignalHandler(int signum);
static void *StartThread(cThread *Thread);
- bool Lock(void);
- void Unlock(void);
+ void Lock(void) { mutex.Lock(); }
+ void Unlock(void) { mutex.Unlock(); }
protected:
void WakeUp(void);
virtual void Action(void) = 0;
@@ -84,7 +83,6 @@ public:
cThreadLock(cThread *Thread = NULL);
~cThreadLock();
bool Lock(cThread *Thread);
- bool Locked(void);
};
#define LOCK_THREAD cThreadLock ThreadLock(this)