Added cThread::SetPriority() and using it in cSectionHandler::Action() to reduce the priority of the section handler threads

This commit is contained in:
Klaus Schmidinger 2005-05-29 11:44:52 +02:00
parent 961e7a9115
commit e622406342
5 changed files with 14 additions and 3 deletions

View File

@ -1366,3 +1366,4 @@ Georg Acher <acher@baycom.de>
for a patch that was used to implement hash tables to speed up cSchedule::GetEvent()
for avoiding unnecessary calls to getLength() in libsi/si.c, and avoiding the
'& 0xff' in CRC32::crc32() of libsi/util.c
for suggesting to reduce the priority of the section handler threads

View File

@ -3575,3 +3575,5 @@ Video Disk Recorder Revision History
- Speeded up deleting duplicate channels.
- Fixed listing recordings with empty episode names in the LSTR command (thanks
to Stefan Huelswitt for pointing this out).
- Added cThread::SetPriority() and using it in cSectionHandler::Action() to
reduce the priority of the section handler threads (as suggested by Georg Acher).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: sections.c 1.10 2004/10/24 11:05:12 kls Exp $
* $Id: sections.c 1.11 2005/05/29 11:43:17 kls Exp $
*/
#include "sections.h"
@ -167,6 +167,7 @@ void cSectionHandler::SetStatus(bool On)
void cSectionHandler::Action(void)
{
active = true;
SetPriority(19);
while (active) {
Lock();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: thread.c 1.42 2005/05/06 14:39:15 kls Exp $
* $Id: thread.c 1.43 2005/05/29 11:40:30 kls Exp $
*/
#include "thread.h"
@ -208,6 +208,12 @@ cThread::~cThread()
free(description);
}
void cThread::SetPriority(int Priority)
{
if (setpriority(PRIO_PROCESS, 0, Priority) < 0)
LOG_ERROR;
}
void cThread::SetDescription(const char *Description, ...)
{
free(description);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: thread.h 1.27 2005/01/14 14:02:14 kls Exp $
* $Id: thread.h 1.28 2005/05/29 11:31:24 kls Exp $
*/
#ifndef __THREAD_H
@ -82,6 +82,7 @@ private:
static bool emergencyExitRequested;
static void *StartThread(cThread *Thread);
protected:
void SetPriority(int Priority);
void Lock(void) { mutex.Lock(); }
void Unlock(void) { mutex.Unlock(); }
virtual void Action(void) = 0;