From 5b57bdebdcecf9e544cbf0af72b77106efa62d8f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 13 Apr 2009 13:55:23 +0200 Subject: [PATCH] Added cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread --- CONTRIBUTORS | 1 + HISTORY | 2 ++ recording.c | 3 ++- thread.c | 8 +++++++- thread.h | 3 ++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6beb396c..c0946220 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1070,6 +1070,7 @@ Rolf Ahrenberg for setting the thread name, so that it can be seen in 'top -H' for replacing the Finnish language code "smi" with "suo" for adding cap_sys_nice to the capabilities that are not dropped + for adding cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index 51d27c32..e694d565 100644 --- a/HISTORY +++ b/HISTORY @@ -6039,3 +6039,5 @@ Video Disk Recorder Revision History 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 (thanks to Helmut Auer). +- Added cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread + (thanks to Rolf Ahrenberg). diff --git a/recording.c b/recording.c index 00965a7d..c86b1636 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -85,6 +85,7 @@ cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void) void cRemoveDeletedRecordingsThread::Action(void) { SetPriority(19); + SetIOPriority(7); // Make sure only one instance of VDR does this: cLockFile LockFile(VideoDirectory); if (LockFile.Lock()) { diff --git a/thread.c b/thread.c index f7e365e8..e6a88980 100644 --- a/thread.c +++ b/thread.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -226,6 +226,12 @@ void cThread::SetPriority(int Priority) 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, ...) { free(description); diff --git a/thread.h b/thread.h index 6eaa79a7..d4919eb6 100644 --- a/thread.h +++ b/thread.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -87,6 +87,7 @@ private: static void *StartThread(cThread *Thread); protected: void SetPriority(int Priority); + void SetIOPriority(int Priority); void Lock(void) { mutex.Lock(); } void Unlock(void) { mutex.Unlock(); } virtual void Action(void) = 0;