diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-06-05 13:07:23 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-06-05 13:07:23 +0200 |
commit | 08b5b39ecb5dc27877b2021e58d74ab011f5b17a (patch) | |
tree | 7d4ef9253e0f1683a2ac177983e1de7d6e30c99f | |
parent | 0b647385bb6e379c253099b32692f867fe1bd428 (diff) | |
download | dabmux-08b5b39ecb5dc27877b2021e58d74ab011f5b17a.tar.gz dabmux-08b5b39ecb5dc27877b2021e58d74ab011f5b17a.tar.bz2 dabmux-08b5b39ecb5dc27877b2021e58d74ab011f5b17a.zip |
Re-enable real-time priority for the multiplexer thread
-rw-r--r-- | src/DabMux.cpp | 16 |
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; |