Added cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread

This commit is contained in:
Klaus Schmidinger 2009-04-13 13:55:23 +02:00
parent b36d06e1ea
commit 5b57bdebdc
5 changed files with 14 additions and 3 deletions

View File

@ -1070,6 +1070,7 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for setting the thread name, so that it can be seen in 'top -H' for setting the thread name, so that it can be seen in 'top -H'
for replacing the Finnish language code "smi" with "suo" for replacing the Finnish language code "smi" with "suo"
for adding cap_sys_nice to the capabilities that are not dropped for adding cap_sys_nice to the capabilities that are not dropped
for adding cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread
Ralf Klueber <ralf.klueber@vodafone.com> Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6039,3 +6039,5 @@ Video Disk Recorder Revision History
caused the selected audio and subtitle tracks to fall back to the default. caused the selected audio and subtitle tracks to fall back to the default.
- The SVDRP command PUTE now supports reading the EPG data from a given file - The SVDRP command PUTE now supports reading the EPG data from a given file
(thanks to Helmut Auer). (thanks to Helmut Auer).
- Added cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread
(thanks to Rolf Ahrenberg).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 2.11 2009/04/13 12:28:36 kls Exp $ * $Id: recording.c 2.12 2009/04/13 13:50:39 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -85,6 +85,7 @@ cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void)
void cRemoveDeletedRecordingsThread::Action(void) void cRemoveDeletedRecordingsThread::Action(void)
{ {
SetPriority(19); SetPriority(19);
SetIOPriority(7);
// Make sure only one instance of VDR does this: // Make sure only one instance of VDR does this:
cLockFile LockFile(VideoDirectory); cLockFile LockFile(VideoDirectory);
if (LockFile.Lock()) { if (LockFile.Lock()) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: thread.c 2.2 2008/09/06 09:39:43 kls Exp $ * $Id: thread.c 2.3 2009/04/13 13:50:39 kls Exp $
*/ */
#include "thread.h" #include "thread.h"
@ -226,6 +226,12 @@ void cThread::SetPriority(int Priority)
LOG_ERROR; LOG_ERROR;
} }
void cThread::SetIOPriority(int Priority)
{
if (syscall(SYS_ioprio_set, 1, 0, (Priority & 0xff) | (2 << 13)) < 0) // best effort class
LOG_ERROR;
}
void cThread::SetDescription(const char *Description, ...) void cThread::SetDescription(const char *Description, ...)
{ {
free(description); free(description);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: thread.h 1.39 2007/02/24 16:13:28 kls Exp $ * $Id: thread.h 2.1 2009/04/13 13:50:39 kls Exp $
*/ */
#ifndef __THREAD_H #ifndef __THREAD_H
@ -87,6 +87,7 @@ private:
static void *StartThread(cThread *Thread); static void *StartThread(cThread *Thread);
protected: protected:
void SetPriority(int Priority); void SetPriority(int Priority);
void SetIOPriority(int Priority);
void Lock(void) { mutex.Lock(); } void Lock(void) { mutex.Lock(); }
void Unlock(void) { mutex.Unlock(); } void Unlock(void) { mutex.Unlock(); }
virtual void Action(void) = 0; virtual void Action(void) = 0;