1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed setting the main thread id if VDR is running as a daemon

This commit is contained in:
Klaus Schmidinger 2006-01-03 10:20:41 +01:00
parent 86197f0206
commit c01259dbb5
4 changed files with 18 additions and 5 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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

5
vdr.c
View File

@ -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():