diff options
author | Jochen Dolze <vdr@dolze.de> | 2011-08-05 14:02:47 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2011-08-05 14:02:47 +0200 |
commit | 8f13f082303ae844d8408b78c8c8fa4c5c9b1d26 (patch) | |
tree | 2c169bdcef39d35dc4f60b7dab1004c727ffb973 /parse.cpp | |
parent | fd38b68561f3c2b0bf2cf369cc3cc48dbca60fc8 (diff) | |
download | vdr-plugin-xmltv2vdr-8f13f082303ae844d8408b78c8c8fa4c5c9b1d26.tar.gz vdr-plugin-xmltv2vdr-8f13f082303ae844d8408b78c8c8fa4c5c9b1d26.tar.bz2 |
Prevent mapping deletion of an disabled channel
Added proper thread cleanup
Diffstat (limited to 'parse.cpp')
-rw-r--r-- | parse.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -14,6 +14,7 @@ #include <locale.h> #include <langinfo.h> +#include "xmltv2vdr.h" #include "parse.h" extern char *strcatrealloc(char *dest, const char *src); @@ -857,7 +858,7 @@ cEPGMapping *cParse::EPGMapping(const char *ChannelName) return NULL; } -int cParse::Process(char *buffer, int bufsize) +int cParse::Process(cEPGExecutor &myExecutor,char *buffer, int bufsize) { if (!buffer) return 134; if (!bufsize) return 134; @@ -877,8 +878,19 @@ int cParse::Process(char *buffer, int bufsize) return 141; } - cSchedulesLock schedulesLock(true,25000); // wait up to 25 secs for lock! - const cSchedules *schedules = cSchedules::Schedules(schedulesLock); + const cSchedules *schedules=NULL; + int l=0; + while (l<300) { + cSchedulesLock schedulesLock(true,200); // wait up to 60 secs for lock! + schedules = cSchedules::Schedules(schedulesLock); + if (!myExecutor.StillRunning()) { + isyslog("xmltv2vdr: '%s' request to stop from vdr",name); + return 0; + } + if (schedules) break; + l++; + } + if (!schedules) { esyslog("xmltv2vdr: '%s' cannot get schedules now, trying later",name); @@ -1045,6 +1057,11 @@ int cParse::Process(char *buffer, int bufsize) } } node=node->next; + if (!myExecutor.StillRunning()) { + xmlFreeDoc(xmltv); + isyslog("xmltv2vdr: '%s' request to stop from vdr",name); + return 0; + } } xmlFreeDoc(xmltv); return 0; |