From 5eb468bce0881d746c7107f6cb226a8c5b9dbc9d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Feb 2014 10:42:24 +0100 Subject: 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). --- src/thread/Util.hxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }; -- cgit v1.2.3