summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-02-25 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-02-25 18:00:00 +0100
commit9f42c33ef6793482a5c2515f9a87c13c0d189c60 (patch)
tree45025e95c0774761760c9bc6a44f4e69a1baf43b /thread.c
parent66ab78a40f5b57e20142a33484e32c785a0c4017 (diff)
downloadvdr-patch-lnbsharing-9f42c33ef6793482a5c2515f9a87c13c0d189c60.tar.gz
vdr-patch-lnbsharing-9f42c33ef6793482a5c2515f9a87c13c0d189c60.tar.bz2
Version 1.5.1vdr-1.5.1
- Added cDevice::HasCi() so that devices with Common Interface can be avoided when tuning to an FTA channel, thus preserving the CAM resources even on budget DVB cards (suggested by Petri Helin). - Fixed i18n characters for the Hungarian texts (thanks to Thomas Günther). - Now using cPipe instead of popen() in cCommand::Execute() to avoid problems with open file handles when starting background commands (thanks to Reinhard Nissl). - Removed 'assert(0)' from cDvbSpuDecoder::setTime() (thanks to Marco Schlüßler). - Fixed a possible crash when loading an invalid XPM file (thanks to Martin Wache). - Updated satellite names in 'sources.conf' (thanks to Thilo Wunderlich). - Adapted 'libsi' to DVB-S2 (thanks to Marco Schlüßler). - Fixed handling error status in cDvbTuner::GetFrontendStatus() (thanks to Reinhard Nissl). - Shutdown handling has been rewritten (thanks to Udo Richter). - Plugins can now implement the new function WakeupTime() to request VDR to wake up at a particular time (thanks to Udo Richter). - The HUP signal now forces a restart of VDR (thanks to Udo Richter). - cThread::EmergencyExit() has been replaced by ShutdownHandler.RequestEmergencyExit(). - Several references to "button" in a remote control context have been changed to "key" (based on a report from Marko Mäkelä regarding the "Menu button closes" text). The "MenuButtonCloses" parameter in 'setup.conf' has therefore been renamed to "MenuKeyCloses", accordingly. This will result in an "unknown config parameter: MenuButtonCloses" error message in the log file, so you may want to remove that entry from your 'setup.conf' file. - Simplified the error handling in cDvbTuner::GetFrontendStatus() (based on a discussion with Reinhard Nissl). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Increased the maximum number of DVB devices to 8 (thanks to Rolf Ahrenberg). - The new Setup parameter "Channel entry timeout" can be used to customize the time since the last keypress until a numerically entered channel number is considered complete, and the channel is switched (suggested by Helmut Auer). Setting this parameter to 0 turns off the automatic channel switching, and the user will have to confirm the entry by pressing the "Ok" key.
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/thread.c b/thread.c
index d2debef..8882252 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.59 2007/01/05 10:44:22 kls Exp $
+ * $Id: thread.c 1.60 2007/02/24 16:13:33 kls Exp $
*/
#include "thread.h"
@@ -200,7 +200,6 @@ void cMutex::Unlock(void)
// --- cThread ---------------------------------------------------------------
tThreadId cThread::mainThreadId = 0;
-bool cThread::emergencyExitRequested = false;
cThread::cThread(const char *Description)
{
@@ -320,14 +319,6 @@ void cThread::Cancel(int WaitSeconds)
}
}
-bool cThread::EmergencyExit(bool Request)
-{
- if (!Request)
- return emergencyExitRequested;
- esyslog("initiating emergency exit");
- return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
-}
-
tThreadId cThread::ThreadId(void)
{
return syscall(__NR_gettid);
@@ -505,7 +496,7 @@ int cPipe::Close(void)
// --- SystemExec ------------------------------------------------------------
-int SystemExec(const char *Command)
+int SystemExec(const char *Command, bool Detached)
{
pid_t pid;
@@ -515,14 +506,24 @@ int SystemExec(const char *Command)
}
if (pid > 0) { // parent process
- int status;
- if (waitpid(pid, &status, 0) < 0) {
+ int status = 0;
+ if (!Detached && waitpid(pid, &status, 0) < 0) {
LOG_ERROR;
return -1;
}
return status;
}
else { // child process
+ if (Detached) {
+ // Start a new session
+ pid_t sid = setsid();
+ if (sid < 0)
+ LOG_ERROR;
+ // close STDIN and re-open as /dev/null
+ int devnull = open("/dev/null", O_RDONLY);
+ if (devnull < 0 || dup2(devnull, 0) < 0)
+ LOG_ERROR;
+ }
int MaxPossibleFileDescriptors = getdtablesize();
for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
close(i); //close all dup'ed filedescriptors