aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DabMux.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index d83dbce..242f947 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -247,17 +247,15 @@ int main(int argc, char *argv[])
strerror(errno));
}
#else
- if (setpriority(PRIO_PROCESS, 0, -20) == -1) {
- etiLog.log(warn, "Can't increase priority: %s\n",
- strerror(errno));
+ // Use the lowest real-time priority for this thread, and switch to real-time scheduling
+ const int policy = SCHED_RR;
+ sched_param sp;
+ sp.sched_priority = sched_get_priority_min(policy);
+ int thread_prio_ret = pthread_setschedparam(pthread_self(), policy, &sp);
+ if (thread_prio_ret != 0) {
+ etiLog.level(error) << "Could not set real-time priority for thread:" << thread_prio_ret;
}
#endif
- /*sched_param scheduler;
- scheduler.sched_priority = 99; // sched_get_priority_max(SCHED_RR)
- if (sched_setscheduler(0, SCHED_RR, &scheduler) == -1) {
- etiLog.log(warn, "Can't increased priority: %s\n",
- strerror(errno));
- }*/
uint8_t watermarkData[128];
size_t watermarkSize = 0;