diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-03 10:20:41 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-03 10:20:41 +0100 |
commit | c01259dbb5cf56490de58d6021c9c2fd135d7c66 (patch) | |
tree | 2d850c3d97f7bcdab4f4acaa6a0576ad842a4f40 | |
parent | 86197f02060c594f0ec46a64b614215dcb5d28b6 (diff) | |
download | vdr-c01259dbb5cf56490de58d6021c9c2fd135d7c66.tar.gz vdr-c01259dbb5cf56490de58d6021c9c2fd135d7c66.tar.bz2 |
Fixed setting the main thread id if VDR is running as a daemon
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | thread.c | 12 | ||||
-rw-r--r-- | thread.h | 3 | ||||
-rw-r--r-- | vdr.c | 5 |
4 files changed, 18 insertions, 5 deletions
@@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History commands may now be executed at any time, and the message will be displayed (no more "pending message"). -2006-01-01: Version 1.3.38 +2006-01-03: Version 1.3.38 - Fixed handling second audio and Dolby Digital PIDs for encrypted channels (was broken in version 1.3.37). @@ -4065,3 +4065,4 @@ Video Disk Recorder Revision History - The Makefile now reports a summary of failed plugins (thanks to Udo Richter). - The cTimer constructor can now take an optional cChannel (suggested by Patrick Fischer). +- Fixed setting the main thread id if VDR is running as a daemon. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 1.48 2006/01/01 14:50:44 kls Exp $ + * $Id: thread.c 1.49 2006/01/03 10:15:54 kls Exp $ */ #include "thread.h" @@ -198,7 +198,7 @@ void cMutex::Unlock(void) // --- cThread --------------------------------------------------------------- -tThreadId cThread::mainThreadId = cThread::ThreadId(); +tThreadId cThread::mainThreadId = 0; bool cThread::emergencyExitRequested = false; cThread::cThread(const char *Description) @@ -320,6 +320,14 @@ tThreadId cThread::ThreadId(void) return gettid(); } +void cThread::SetMainThreadId(void) +{ + if (mainThreadId == 0) + mainThreadId = ThreadId(); + else + esyslog("ERROR: attempt to set main thread id to %d while it already is %d", ThreadId(), mainThreadId); +} + // --- cMutexLock ------------------------------------------------------------ cMutexLock::cMutexLock(cMutex *Mutex) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.h 1.33 2005/12/11 12:04:56 kls Exp $ + * $Id: thread.h 1.34 2006/01/03 10:10:32 kls Exp $ */ #ifndef __THREAD_H @@ -117,6 +117,7 @@ public: static bool EmergencyExit(bool Request = false); static tThreadId ThreadId(void); static tThreadId IsMainThread(void) { return ThreadId() == mainThreadId; } + static void SetMainThreadId(void); }; // cMutexLock can be used to easily set a lock on mutex and make absolutely @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.224 2005/12/31 13:30:11 kls Exp $ + * $Id: vdr.c 1.225 2006/01/03 10:20:41 kls Exp $ */ #include <getopt.h> @@ -473,6 +473,9 @@ int main(int argc, char *argv[]) isyslog("VDR version %s started", VDRVERSION); if (StartedAsRoot) isyslog("switched to user '%s'", VdrUser); + if (DaemonMode) + dsyslog("running as daemon (tid=%d)", cThread::ThreadId()); + cThread::SetMainThreadId(); // Main program loop variables - need to be here to have them initialized before any EXIT(): |