aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-18 10:42:24 +0100
committerMax Kellermann <max@duempel.org>2014-02-18 10:43:24 +0100
commit5eb468bce0881d746c7107f6cb226a8c5b9dbc9d (patch)
tree9ff65b1b30b5ae3e651292767f3033a14985e2cc /src
parent7f8dd0e9391486c963b7edd06994ca7efcb861f7 (diff)
downloadmpd-5eb468bce0881d746c7107f6cb226a8c5b9dbc9d.tar.gz
mpd-5eb468bce0881d746c7107f6cb226a8c5b9dbc9d.tar.xz
mpd-5eb468bce0881d746c7107f6cb226a8c5b9dbc9d.zip
Thread/Util: make SCHED_RESET_ON_FORK optional
Use it if it exists, but don't insist if the C library is poor (e.g. Bionic/Android).
Diffstat (limited to 'src')
-rw-r--r--src/thread/Util.hxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/thread/Util.hxx b/src/thread/Util.hxx
index d71230c20..62c5c6c2f 100644
--- a/src/thread/Util.hxx
+++ b/src/thread/Util.hxx
@@ -78,7 +78,13 @@ SetThreadRealtime()
#ifdef __linux__
struct sched_param sched_param;
sched_param.sched_priority = 50;
- sched_setscheduler(0, SCHED_FIFO|SCHED_RESET_ON_FORK, &sched_param);
+
+ int policy = SCHED_FIFO;
+#ifdef SCHED_RESET_ON_FORK
+ policy |= SCHED_RESET_ON_FORK;
+#endif
+
+ sched_setscheduler(0, policy, &sched_param);
#endif
};