summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-04-08 21:58:03 +0200
committerJochen Dolze <vdr@dolze.de>2012-04-08 21:58:03 +0200
commit66f0d0e0ff9a8e6f8d80c0f4f75ae54c8eafcb92 (patch)
tree4ccbd7e6725cefee426a741ea9b03260548f292c
parent11d34a334a55b98950634be3612ed78eece8407d (diff)
downloadvdr-plugin-xmltv2vdr-66f0d0e0ff9a8e6f8d80c0f4f75ae54c8eafcb92.tar.gz
vdr-plugin-xmltv2vdr-66f0d0e0ff9a8e6f8d80c0f4f75ae54c8eafcb92.tar.bz2
Added ioprio_set to all threads and epghandler
-rw-r--r--source.cpp6
-rw-r--r--xmltv2vdr.cpp38
-rw-r--r--xmltv2vdr.h2
3 files changed, 46 insertions, 0 deletions
diff --git a/source.cpp b/source.cpp
index 8f5b98d..b0fe237 100644
--- a/source.cpp
+++ b/source.cpp
@@ -44,6 +44,12 @@ void cEPGExecutor::Action()
if (!sources) return;
if (!baseplugin) return;
+ SetPriority(19);
+ if (ioprio_set(1,getpid(),7 | 3 << 13)==-1)
+ {
+ esyslog("xmltv2vdr: failed to set ioprio to 3,7");
+ }
+
for (cEPGSource *epgs=sources->First(); epgs; epgs=sources->Next(epgs))
{
if (epgs->RunItNow())
diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp
index f0d83f9..b34f855 100644
--- a/xmltv2vdr.cpp
+++ b/xmltv2vdr.cpp
@@ -14,6 +14,29 @@
#include "setup.h"
#include "xmltv2vdr.h"
+int ioprio_set(int which, int who, int ioprio)
+{
+#if defined(__i386__)
+#define __NR_ioprio_set 289
+#elif defined(__ppc__)
+#define __NR_ioprio_set 273
+#elif defined(__x86_64__)
+#define __NR_ioprio_set 251
+#elif defined(__ia64__)
+#define __NR_ioprio_set 1274
+#else
+#define __NR_ioprio_set 0
+#endif
+ if (__NR_ioprio_set)
+ {
+ return syscall(__NR_ioprio_set, which, who, ioprio);
+ }
+ else
+ {
+ return 0; // just do nothing
+ }
+}
+
// -------------------------------------------------------------
cEPGHandler::cEPGHandler(cPluginXmltv2vdr *Plugin, const char *EpgFile, cEPGSources *Sources,
@@ -84,6 +107,11 @@ bool cEPGHandler::SetDescription(cEvent* Event, const char* Description)
ChannelID=map->ChannelName();
}
+ if (ioprio_set(1,getpid(),7 | 3 << 13)==-1)
+ {
+ esyslog("xmltv2vdr: failed to set ioprio to 3,7");
+ }
+
cXMLTVEvent *xevent=import->SearchXMLTVEvent(epgfile,ChannelID,Event);
if (!xevent)
{
@@ -139,6 +167,11 @@ bool cEPGHandler::SetShortText(cEvent* Event, const char* UNUSED(ShortText))
cEPGMapping *map=maps->GetMap(Event->ChannelID());
if (!map) return false;
+ if (ioprio_set(1,getpid(),7 | 3 << 13)==-1)
+ {
+ esyslog("xmltv2vdr: failed to set ioprio to 3,7");
+ }
+
cXMLTVEvent *xevent=import->SearchXMLTVEvent(epgfile,map->ChannelName(),Event);
if (!xevent) return false;
@@ -173,6 +206,11 @@ void cEPGTimer::Action()
struct stat statbuf;
if (stat(epgfile,&statbuf)==-1) return; // no database? -> exit immediately
if (!statbuf.st_size) return; // no database? -> exit immediately
+ SetPriority(19);
+ if (ioprio_set(1,getpid(),7 | 3 << 13)==-1)
+ {
+ esyslog("xmltv2vdr: failed to set ioprio to 3,7");
+ }
cSchedulesLock *schedulesLock = new cSchedulesLock(true,2000); // wait up to 2 secs for lock!
const cSchedules *schedules = cSchedules::Schedules(*schedulesLock);
diff --git a/xmltv2vdr.h b/xmltv2vdr.h
index 8805a16..f0da36a 100644
--- a/xmltv2vdr.h
+++ b/xmltv2vdr.h
@@ -23,6 +23,8 @@
static const char *VERSION = "0.1.1pre";
static const char *DESCRIPTION = trNOOP("Imports xmltv epg into vdr");
+int ioprio_set(int which, int who, int ioprio);
+
#if VDRVERSNUM < 10726 && !EPGHANDLER
class cEpgHandler : public cListObject
{