summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY3
-rw-r--r--HISTORY.DE2
-rw-r--r--conflictcheck_thread.c10
-rw-r--r--epgsearch.c10
-rw-r--r--epgsearch.h3
-rw-r--r--searchtimer_thread.c6
-rw-r--r--switchtimer_thread.c6
7 files changed, 29 insertions, 11 deletions
diff --git a/HISTORY b/HISTORY
index c662d69..48ba611 100644
--- a/HISTORY
+++ b/HISTORY
@@ -47,6 +47,9 @@ new:
- some speed enhancements, thanks to Tobias Bratfisch for providing patches
- if the VPS time differs from the start time of an event the VPS marker is now 'v'
instead of 'V'
+- the first run of the background threads (searchtimer, switchtimer, conflict check) is now
+ triggered by the first call to cPlugin::MainThreadHook instead of waiting 20s after
+ VDRs startup.
fixes:
- fixed a crash when pressing 'Ok' in an empty timers done menu
diff --git a/HISTORY.DE b/HISTORY.DE
index 0126016..15b4abf 100644
--- a/HISTORY.DE
+++ b/HISTORY.DE
@@ -52,6 +52,8 @@ neu:
- einige Geschwindigkeitsverbesserungen, Danke an Tobias Bratfisch für die Patches
- falls die VPS-Zeit von der Startzeit einer Sendung abweicht, wird die VPS-Kennung nun mit
'v' statt 'V' angezeigt.
+- Der erste Lauf der Hintergrund-Threads (Suchtimer, Umschalttimer, Konfliktprüfung) wird nun
+ durch den ersten Aufruf von cPlugin::MainThreadHook ausgelöst, anstatt 20s nach dem VDR-Start.
fixes:
- Absturz beim Drücken von 'Ok' in leerem Menü erledigter Timer behoben
diff --git a/conflictcheck_thread.c b/conflictcheck_thread.c
index 6aaf3bb..4da08a5 100644
--- a/conflictcheck_thread.c
+++ b/conflictcheck_thread.c
@@ -25,9 +25,9 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "conflictcheck_thread.h"
#include "epgsearchcfg.h"
#include "mail.h"
+#include "epgsearch.h"
#define CONFLICTCHECK_NICE 19
-#define CONFLCHECK_WAIT 20
cConflictCheckThread *cConflictCheckThread::m_Instance = NULL;
time_t cConflictCheckThread::m_cacheNextConflict = 0;
@@ -88,8 +88,12 @@ void cConflictCheckThread::Action(void)
m_Active = true;
// let VDR do its startup
if (!m_runOnce)
- for(int wait = 0; wait < CONFLCHECK_WAIT && m_Active; wait++)
- Wait.Wait(1000);
+ {
+ if (!cPluginEpgsearch::VDR_readyafterStartup)
+ LogFile.Log(2, "ConflictCheckThread: waiting for VDR to become ready...");
+ while(m_Active && !cPluginEpgsearch::VDR_readyafterStartup)
+ Wait.Wait(1000);
+ }
time_t nextUpdate = time(NULL);
while (m_Active)
diff --git a/epgsearch.c b/epgsearch.c
index 2117bd8..fd63219 100644
--- a/epgsearch.c
+++ b/epgsearch.c
@@ -79,6 +79,7 @@ bool isUTF8 = false;
cLogFile LogFile;
char *cLogFile::LogFileName = NULL;
int cLogFile::loglevellimit = 0;
+bool cPluginEpgsearch::VDR_readyafterStartup = false;
// external SVDRPCommand
const char *cSVDRPClient::SVDRPSendCmd = "svdrpsend.pl";
@@ -474,9 +475,14 @@ void cPluginEpgsearch::Stop(void)
cSwitchTimerThread::Exit();
}
-void cPluginEpgsearch::Housekeeping(void)
+void cPluginEpgsearch::MainThreadHook(void)
{
- // Perform any cleanup or other regular tasks.
+ if (!VDR_readyafterStartup)
+ {
+ // signal VDR is ready, otherwise the search timer thread could use SVDRP before it works
+ LogFile.Log(2, "VDR ready");
+ VDR_readyafterStartup = true;
+ }
}
cOsdObject *cPluginEpgsearch::DoInitialSearch(char* rcFilename)
diff --git a/epgsearch.h b/epgsearch.h
index dbb9f57..a4bf721 100644
--- a/epgsearch.h
+++ b/epgsearch.h
@@ -30,6 +30,7 @@ class cPluginEpgsearch : public cPlugin {
public:
bool showConflicts;
bool showAnnounces;
+ static bool VDR_readyafterStartup;
cPluginEpgsearch(void);
virtual ~cPluginEpgsearch();
@@ -40,7 +41,7 @@ public:
virtual bool Initialize(void);
virtual bool Start(void);
virtual void Stop(void);
- virtual void Housekeeping(void);
+ virtual void MainThreadHook(void);
virtual const char *MainMenuEntry(void);
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
diff --git a/searchtimer_thread.c b/searchtimer_thread.c
index 3cc2417..c2aca95 100644
--- a/searchtimer_thread.c
+++ b/searchtimer_thread.c
@@ -45,8 +45,6 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
// priority for background thread
#define SEARCHTIMER_NICE 19
-// delay before first thread activity
-#define SEARCHTIMER_WAIT 20
#define DAYBUFFERSIZE 32
@@ -200,7 +198,9 @@ void cSearchTimerThread::Action(void)
m_Active = true;
// let VDR do its startup
- for(int wait = 0; wait < SEARCHTIMER_WAIT && m_Active; wait++)
+ if (!cPluginEpgsearch::VDR_readyafterStartup)
+ LogFile.Log(2, "SearchTimerThread: waiting for VDR to become ready...");
+ while(m_Active && !cPluginEpgsearch::VDR_readyafterStartup)
Wait.Wait(1000);
time_t nextUpdate = time(NULL);
diff --git a/switchtimer_thread.c b/switchtimer_thread.c
index dda24e9..68f3609 100644
--- a/switchtimer_thread.c
+++ b/switchtimer_thread.c
@@ -24,11 +24,11 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "switchtimer_thread.h"
#include "epgsearchcfg.h"
#include "epgsearchtools.h"
+#include "epgsearch.h"
#include <vdr/tools.h>
#include <vdr/plugin.h>
#define MSG_DELAY 7
-#define SWITCHTIMER_WAIT 20
cSwitchTimerThread *cSwitchTimerThread::m_Instance = NULL;
@@ -69,7 +69,9 @@ void cSwitchTimerThread::Action(void)
m_Active = true;
// let VDR do its startup
- for(int wait = 0; wait < SWITCHTIMER_WAIT && m_Active; wait++)
+ if (!cPluginEpgsearch::VDR_readyafterStartup)
+ LogFile.Log(2, "SwitchTimerThread: waiting for VDR to become ready...");
+ while(m_Active && !cPluginEpgsearch::VDR_readyafterStartup)
Wait.Wait(1000);
time_t nextUpdate = time(NULL);