summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY5
-rw-r--r--dvbapi.c4
-rw-r--r--thread.c23
-rw-r--r--thread.h5
4 files changed, 33 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index 89be5a2a..bac0697b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -534,7 +534,10 @@ Video Disk Recorder Revision History
- No longer getting stuck when a channel doesn't sync while switching
with the 'Up' and 'Down' keys.
-2001-06-27: Version 0.84
+2001-07-12: Version 0.84
- Fixed video packet scanning to make it recognize the whole range of
allowed video packet ids.
+- Added an additional "emergency exit" in case channel switching doesn't
+ work several times in a row (when will the driver finally become stable
+ enough to allow rock solid channel switching??).
diff --git a/dvbapi.c b/dvbapi.c
index d1dc5283..45a526b4 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.c 1.81 2001/06/27 08:32:32 kls Exp $
+ * $Id: dvbapi.c 1.82 2001/06/27 11:34:17 kls Exp $
*/
#include "dvbapi.h"
@@ -2222,6 +2222,8 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
if (!ChannelSynced) {
esyslog(LOG_ERR, "ERROR: channel %d not sync'ed!", ChannelNumber);
+ if (this == PrimaryDvbApi)
+ cThread::RaisePanic();
return false;
}
diff --git a/thread.c b/thread.c
index aa6ed64c..e253ea04 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.8 2001/05/25 09:37:00 kls Exp $
+ * $Id: thread.c 1.9 2001/06/27 11:34:41 kls Exp $
*/
#include "thread.h"
@@ -47,6 +47,8 @@ void cMutex::Unlock(void)
// The signal handler is necessary to be able to use SIGIO to wake up any
// pending 'select()' call.
+time_t cThread::lastPanic = 0;
+int cThread::panicLevel = 0;
bool cThread::signalHandlerInstalled = false;
bool cThread::emergencyExitRequested = false;
@@ -139,6 +141,25 @@ void cThread::WakeUp(void)
kill(parentPid, SIGIO); // makes any waiting 'select()' call return immediately
}
+#define MAXPANICLEVEL 10
+
+void cThread::RaisePanic(void)
+{
+ if (lastPanic > 0) {
+ if (time(NULL) - lastPanic < 5)
+ panicLevel++;
+ else if (panicLevel > 0)
+ panicLevel--;
+ }
+ lastPanic = time(NULL);
+ if (panicLevel > MAXPANICLEVEL) {
+ esyslog(LOG_ERR, "ERROR: max. panic level exceeded");
+ EmergencyExit(true);
+ }
+ else
+ dsyslog(LOG_INFO, "panic level: %d", panicLevel);
+}
+
bool cThread::EmergencyExit(bool Request)
{
if (!Request)
diff --git a/thread.h b/thread.h
index 8885fd46..bf9804d3 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.5 2001/05/25 09:36:27 kls Exp $
+ * $Id: thread.h 1.6 2001/06/27 11:22:04 kls Exp $
*/
#ifndef __THREAD_H
@@ -33,6 +33,8 @@ private:
pid_t parentPid, threadPid, lockingPid;
int locked;
bool running;
+ static time_t lastPanic;
+ static int panicLevel;
static bool emergencyExitRequested;
static bool signalHandlerInstalled;
static void SignalHandler(int signum);
@@ -48,6 +50,7 @@ public:
virtual ~cThread();
bool Start(void);
bool Active(void);
+ static void RaisePanic(void);
static bool EmergencyExit(bool Request = false);
};