summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-15 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-15 18:00:00 +0200
commitddd1e13e53c4970058884e2af31c2681617e7bf3 (patch)
tree672e7c0a5ddf85a40015104a2906e77fe60beccc /thread.c
parent4c5de2888331fb4372eba0b0f4364fd9a0197b17 (diff)
downloadvdr-patch-lnbsharing-ddd1e13e53c4970058884e2af31c2681617e7bf3.tar.gz
vdr-patch-lnbsharing-ddd1e13e53c4970058884e2af31c2681617e7bf3.tar.bz2
Version 1.3.29vdr-1.3.29
- Fixed a race condition in cTransfer (thanks to Klaus Heppenheimer for reporting this one). In doing so, the 'active' variables used by the actual derived cThread classes have been replaced by the cThread::Running() function. Plugin authors may want to check their derived cThread classes and replace any 'active' variables the same way as, for instance, done in transfer.c. - Fixed handling EPG data for time shifted events (thanks to Marco Schlüßler). - Increased the default value for 'Min. user inactivity' to 300 minutes (suggested by Helmut Auer). - Now storing the channel id in the info.vdr file even if there is no EPG info available (thanks to Andreas Brachold for reporting that there are empty info.vdr files created in that case). - Added some 'mkdir -p' to the Makefile's 'install' target (thanks to Wayne Keer). - Changed the title of the recording info menu (thanks to Rolf Ahrenberg). - Fixed handling the frame number display if '7' is pressed before the first editing mark, or '9' after the last one (thanks to Thomas Günther). - Now discarding any previous numerical input to switch channels if Up, Down, Channel+, Channel-, Left or Right is pressed (thanks to Wolfgang Rohdewald for reporting a problem with this). - Pressing Ok while entering a channel number now immediately switches to that channel, without waiting for further input. - Avoiding unnecessary OSD draw operations caused by the audio track description display in the ST:TNG skin's channel display (thanks to Oliver Endriss for reporting this). - Removed the VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES stuff from cDvbDevice::StillPicture(), since apparently the VIDEO_STILLPICTURE call works.
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index 9ac1b7e..3fa4100 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.43 2005/05/29 11:40:30 kls Exp $
+ * $Id: thread.c 1.45 2005/08/14 11:15:42 kls Exp $
*/
#include "thread.h"
@@ -197,7 +197,7 @@ bool cThread::emergencyExitRequested = false;
cThread::cThread(const char *Description)
{
- running = false;
+ active = running = false;
childTid = 0;
description = NULL;
SetDescription(Description);
@@ -205,6 +205,7 @@ cThread::cThread(const char *Description)
cThread::~cThread()
{
+ Cancel(); // just in case the derived class didn't call it
free(description);
}
@@ -234,20 +235,21 @@ void *cThread::StartThread(cThread *Thread)
if (Thread->description)
dsyslog("%s thread ended (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self());
Thread->running = false;
+ Thread->active = false;
return NULL;
}
bool cThread::Start(void)
{
- if (!running) {
- running = true;
+ if (!active) {
+ active = running = true;
if (pthread_create(&childTid, NULL, (void *(*) (void *))&StartThread, (void *)this) == 0) {
pthread_detach(childTid); // auto-reap
pthread_setschedparam(childTid, SCHED_RR, 0);
}
else {
LOG_ERROR;
- running = false;
+ active = running = false;
return false;
}
}
@@ -256,7 +258,7 @@ bool cThread::Start(void)
bool cThread::Active(void)
{
- if (running) {
+ if (active) {
//
// Single UNIX Spec v2 says:
//
@@ -271,7 +273,7 @@ bool cThread::Active(void)
if (err != ESRCH)
LOG_ERROR;
childTid = 0;
- running = false;
+ active = running = false;
}
else
return true;
@@ -281,7 +283,8 @@ bool cThread::Active(void)
void cThread::Cancel(int WaitSeconds)
{
- if (running) {
+ running = false;
+ if (active) {
if (WaitSeconds > 0) {
for (time_t t0 = time(NULL) + WaitSeconds; time(NULL) < t0; ) {
if (!Active())
@@ -292,7 +295,7 @@ void cThread::Cancel(int WaitSeconds)
}
pthread_cancel(childTid);
childTid = 0;
- running = false;
+ active = false;
}
}