diff options
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 2.5 2012/09/20 09:05:50 kls Exp $ + * $Id: thread.c 2.6 2012/10/04 12:20:43 kls Exp $ */ #include "thread.h" @@ -204,7 +204,7 @@ void cMutex::Unlock(void) tThreadId cThread::mainThreadId = 0; -cThread::cThread(const char *Description) +cThread::cThread(const char *Description, bool LowPriority) { active = running = false; childTid = 0; @@ -212,6 +212,7 @@ cThread::cThread(const char *Description) description = NULL; if (Description) SetDescription("%s", Description); + lowPriority = LowPriority; } cThread::~cThread() @@ -248,12 +249,16 @@ void *cThread::StartThread(cThread *Thread) { Thread->childThreadId = ThreadId(); if (Thread->description) { - dsyslog("%s thread started (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId); + dsyslog("%s thread started (pid=%d, tid=%d, prio=%s)", Thread->description, getpid(), Thread->childThreadId, Thread->lowPriority ? "low" : "high"); #ifdef PR_SET_NAME if (prctl(PR_SET_NAME, Thread->description, 0, 0, 0) < 0) esyslog("%s thread naming failed (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId); #endif } + if (Thread->lowPriority) { + Thread->SetPriority(19); + Thread->SetIOPriority(7); + } Thread->Action(); if (Thread->description) dsyslog("%s thread ended (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId); |