aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread/Util.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-14 09:59:04 +0100
committerMax Kellermann <max@duempel.org>2014-01-14 09:59:04 +0100
commit4734af747b3f7c4560cbf7757f4d857445382f01 (patch)
treea6c7a68994f7eddcc8f05bc808c39ae5f133f86f /src/thread/Util.hxx
parent5d17731b73bf485f8536fb6284ab32cdbb4789b0 (diff)
downloadmpd-4734af747b3f7c4560cbf7757f4d857445382f01.tar.gz
mpd-4734af747b3f7c4560cbf7757f4d857445382f01.tar.xz
mpd-4734af747b3f7c4560cbf7757f4d857445382f01.zip
OutputThread: use real-time priority
Diffstat (limited to '')
-rw-r--r--src/thread/Util.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/thread/Util.hxx b/src/thread/Util.hxx
index fe36468c3..c09fef532 100644
--- a/src/thread/Util.hxx
+++ b/src/thread/Util.hxx
@@ -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