Allow setting different priorities than 5

This commit is contained in:
Robbert van der Helm
2021-01-23 14:24:01 +01:00
parent 7c636ffcb1
commit 33dd469d36
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -41,8 +41,8 @@ std::optional<int> get_scheduling_priority() {
}
}
bool set_realtime_priority(bool sched_fifo) {
sched_param params{.sched_priority = 5};
bool set_realtime_priority(bool sched_fifo, int priority) {
sched_param params{.sched_priority = (sched_fifo ? priority : 0)};
return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER,
&params) == 0;
}