mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
The cThread constructor now has an additional boolean parameter that can be set to true to have this thread run at a lower priority
This commit is contained in:
parent
5a407d0e68
commit
1e9b16d20b
7
HISTORY
7
HISTORY
@ -7272,7 +7272,7 @@ Video Disk Recorder Revision History
|
|||||||
".keep" to prevent a directory from being deleted when it is empty. Currently the
|
".keep" to prevent a directory from being deleted when it is empty. Currently the
|
||||||
only file name that is ignored is ".sort".
|
only file name that is ignored is ".sort".
|
||||||
|
|
||||||
2012-10-03: Version 1.7.32
|
2012-10-04: Version 1.7.32
|
||||||
|
|
||||||
- Pressing the Play key during normal live viewing mode now opens the Recordings menu
|
- Pressing the Play key during normal live viewing mode now opens the Recordings menu
|
||||||
if there is no "last viewed" recording (thanks to Alexander Wenzel).
|
if there is no "last viewed" recording (thanks to Alexander Wenzel).
|
||||||
@ -7280,3 +7280,8 @@ Video Disk Recorder Revision History
|
|||||||
- cIoThrottle::Engaged() is now also checked in cRemoveDeletedRecordingsThread::Action(),
|
- cIoThrottle::Engaged() is now also checked in cRemoveDeletedRecordingsThread::Action(),
|
||||||
to suspend removing deleted recordings in case this is necessary to make room for
|
to suspend removing deleted recordings in case this is necessary to make room for
|
||||||
new, ongoing recordings (suggested by Udo Richter).
|
new, ongoing recordings (suggested by Udo Richter).
|
||||||
|
- The cThread constructor now has an additional boolean parameter that can be set to
|
||||||
|
true to have this thread run at a lower priority. Plugin authors that use low
|
||||||
|
priority threads may want to use this instead of the calls to SetPriority(19) and
|
||||||
|
SetIOPriority(7). The priority of a thread ("low" or "high") is now logged when the
|
||||||
|
thread starts.
|
||||||
|
6
cutter.c
6
cutter.c
@ -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: cutter.c 2.14 2012/09/20 09:12:47 kls Exp $
|
* $Id: cutter.c 2.15 2012/10/04 12:19:37 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cutter.h"
|
#include "cutter.h"
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName)
|
cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName)
|
||||||
:cThread("video cutting")
|
:cThread("video cutting", true)
|
||||||
{
|
{
|
||||||
error = NULL;
|
error = NULL;
|
||||||
fromFile = toFile = NULL;
|
fromFile = toFile = NULL;
|
||||||
@ -69,8 +69,6 @@ void cCuttingThread::Action(void)
|
|||||||
{
|
{
|
||||||
cMark *Mark = fromMarks.First();
|
cMark *Mark = fromMarks.First();
|
||||||
if (Mark) {
|
if (Mark) {
|
||||||
SetPriority(19);
|
|
||||||
SetIOPriority(7);
|
|
||||||
fromFile = fromFileName->Open();
|
fromFile = fromFileName->Open();
|
||||||
toFile = toFileName->Open();
|
toFile = toFileName->Open();
|
||||||
if (!fromFile || !toFile)
|
if (!fromFile || !toFile)
|
||||||
|
6
epg.c
6
epg.c
@ -7,7 +7,7 @@
|
|||||||
* Original version (as used in VDR before 1.3.0) written by
|
* Original version (as used in VDR before 1.3.0) written by
|
||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||||
*
|
*
|
||||||
* $Id: epg.c 2.21 2012/09/29 14:29:49 kls Exp $
|
* $Id: epg.c 2.22 2012/10/04 12:21:24 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "epg.h"
|
#include "epg.h"
|
||||||
@ -1148,14 +1148,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
cEpgDataWriter::cEpgDataWriter(void)
|
cEpgDataWriter::cEpgDataWriter(void)
|
||||||
:cThread("epg data writer")
|
:cThread("epg data writer", true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void cEpgDataWriter::Action(void)
|
void cEpgDataWriter::Action(void)
|
||||||
{
|
{
|
||||||
SetPriority(19);
|
|
||||||
SetIOPriority(7);
|
|
||||||
Perform();
|
Perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.65 2012/10/03 12:52:13 kls Exp $
|
* $Id: recording.c 2.66 2012/10/04 12:21:38 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -83,14 +83,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void)
|
cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void)
|
||||||
:cThread("remove deleted recordings")
|
:cThread("remove deleted recordings", true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRemoveDeletedRecordingsThread::Action(void)
|
void cRemoveDeletedRecordingsThread::Action(void)
|
||||||
{
|
{
|
||||||
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()) {
|
||||||
|
@ -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: sections.c 2.1 2012/08/26 12:53:39 kls Exp $
|
* $Id: sections.c 2.2 2012/10/04 12:21:59 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sections.h"
|
#include "sections.h"
|
||||||
@ -40,7 +40,7 @@ public:
|
|||||||
// --- cSectionHandler -------------------------------------------------------
|
// --- cSectionHandler -------------------------------------------------------
|
||||||
|
|
||||||
cSectionHandler::cSectionHandler(cDevice *Device)
|
cSectionHandler::cSectionHandler(cDevice *Device)
|
||||||
:cThread("section handler")
|
:cThread("section handler", true)
|
||||||
{
|
{
|
||||||
shp = new cSectionHandlerPrivate;
|
shp = new cSectionHandlerPrivate;
|
||||||
device = Device;
|
device = Device;
|
||||||
@ -164,7 +164,6 @@ void cSectionHandler::SetStatus(bool On)
|
|||||||
|
|
||||||
void cSectionHandler::Action(void)
|
void cSectionHandler::Action(void)
|
||||||
{
|
{
|
||||||
SetPriority(19);
|
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
|
11
thread.c
11
thread.c
@ -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.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"
|
#include "thread.h"
|
||||||
@ -204,7 +204,7 @@ void cMutex::Unlock(void)
|
|||||||
|
|
||||||
tThreadId cThread::mainThreadId = 0;
|
tThreadId cThread::mainThreadId = 0;
|
||||||
|
|
||||||
cThread::cThread(const char *Description)
|
cThread::cThread(const char *Description, bool LowPriority)
|
||||||
{
|
{
|
||||||
active = running = false;
|
active = running = false;
|
||||||
childTid = 0;
|
childTid = 0;
|
||||||
@ -212,6 +212,7 @@ cThread::cThread(const char *Description)
|
|||||||
description = NULL;
|
description = NULL;
|
||||||
if (Description)
|
if (Description)
|
||||||
SetDescription("%s", Description);
|
SetDescription("%s", Description);
|
||||||
|
lowPriority = LowPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
cThread::~cThread()
|
cThread::~cThread()
|
||||||
@ -248,12 +249,16 @@ void *cThread::StartThread(cThread *Thread)
|
|||||||
{
|
{
|
||||||
Thread->childThreadId = ThreadId();
|
Thread->childThreadId = ThreadId();
|
||||||
if (Thread->description) {
|
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
|
#ifdef PR_SET_NAME
|
||||||
if (prctl(PR_SET_NAME, Thread->description, 0, 0, 0) < 0)
|
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);
|
esyslog("%s thread naming failed (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (Thread->lowPriority) {
|
||||||
|
Thread->SetPriority(19);
|
||||||
|
Thread->SetIOPriority(7);
|
||||||
|
}
|
||||||
Thread->Action();
|
Thread->Action();
|
||||||
if (Thread->description)
|
if (Thread->description)
|
||||||
dsyslog("%s thread ended (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId);
|
dsyslog("%s thread ended (pid=%d, tid=%d)", Thread->description, getpid(), Thread->childThreadId);
|
||||||
|
7
thread.h
7
thread.h
@ -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 2.2 2012/09/20 08:46:27 kls Exp $
|
* $Id: thread.h 2.3 2012/10/04 12:15:39 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __THREAD_H
|
#ifndef __THREAD_H
|
||||||
@ -83,6 +83,7 @@ private:
|
|||||||
tThreadId childThreadId;
|
tThreadId childThreadId;
|
||||||
cMutex mutex;
|
cMutex mutex;
|
||||||
char *description;
|
char *description;
|
||||||
|
bool lowPriority;
|
||||||
static tThreadId mainThreadId;
|
static tThreadId mainThreadId;
|
||||||
static void *StartThread(cThread *Thread);
|
static void *StartThread(cThread *Thread);
|
||||||
protected:
|
protected:
|
||||||
@ -106,11 +107,13 @@ protected:
|
|||||||
///< If WaitSeconds is -1, only 'running' is set to false and Cancel()
|
///< If WaitSeconds is -1, only 'running' is set to false and Cancel()
|
||||||
///< returns immediately, without killing the thread.
|
///< returns immediately, without killing the thread.
|
||||||
public:
|
public:
|
||||||
cThread(const char *Description = NULL);
|
cThread(const char *Description = NULL, bool LowPriority = false);
|
||||||
///< Creates a new thread.
|
///< Creates a new thread.
|
||||||
///< If Description is present, a log file entry will be made when
|
///< If Description is present, a log file entry will be made when
|
||||||
///< the thread starts and stops. The Start() function must be called
|
///< the thread starts and stops. The Start() function must be called
|
||||||
///< to actually start the thread.
|
///< to actually start the thread.
|
||||||
|
///< LowPriority can be set to true to make this thread run at a lower
|
||||||
|
///< priority.
|
||||||
virtual ~cThread();
|
virtual ~cThread();
|
||||||
void SetDescription(const char *Description, ...) __attribute__ ((format (printf, 2, 3)));
|
void SetDescription(const char *Description, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
bool Start(void);
|
bool Start(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user