From e84f7425cff99cf018279e0882758abc1e74e68c Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 21 Jan 2021 20:33:50 +0100 Subject: [PATCH] Fix reverting to SCHED_OTHER This still seemed to work, but the `sched_setscheduler` would return an error code when the priority is set to 5 for SCHED_OTHER (which is of course not a valid value here). --- src/common/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 3bada5ca..3e1d073b 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -42,7 +42,7 @@ bool set_realtime_priority(bool sched_fifo) { } } - sched_param params{.sched_priority = 5}; + sched_param params{.sched_priority = (sched_fifo ? 5 : 0)}; return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER, ¶ms) == 0; }