OutputThread: use real-time priority
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "PlayerControl.hxx"
|
||||
#include "MusicPipe.hxx"
|
||||
#include "MusicChunk.hxx"
|
||||
#include "thread/Util.hxx"
|
||||
#include "system/FatalError.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
@@ -578,6 +579,8 @@ audio_output_task(void *arg)
|
||||
{
|
||||
struct audio_output *ao = (struct audio_output *)arg;
|
||||
|
||||
SetThreadRealtime();
|
||||
|
||||
ao->mutex.lock();
|
||||
|
||||
while (1) {
|
||||
|
@@ -69,4 +69,17 @@ SetThreadIdlePriority()
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Raise the current thread's priority to "real-time" (very high).
|
||||
*/
|
||||
static inline void
|
||||
SetThreadRealtime()
|
||||
{
|
||||
#ifdef __linux__
|
||||
struct sched_param sched_param;
|
||||
sched_param.sched_priority = 50;
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched_param);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user