diff options
author | Chris Robinson <[email protected]> | 2022-01-18 14:32:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-01-18 14:32:15 -0800 |
commit | 5306c9d42460001670a90a8f091cef47c0aede2c (patch) | |
tree | 81fe60e2514cf066f963ebd095c4ada772c511f4 /core/helpers.cpp | |
parent | 4920167fa0c90b276459107c18a67cf64bd11c4d (diff) |
Set niceness as a fallback only on Linux
If pthread_setschedparam and rtkit_make_realtime both fail, lowering niceness
can also work to boost priority. However, this only works on Linux and other
OSs that implement a per-thread niceness (POSIX standard has it per-process,
which isn't desirable behavior here).
Diffstat (limited to 'core/helpers.cpp')
-rw-r--r-- | core/helpers.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/helpers.cpp b/core/helpers.cpp index c9edb479..3cc7bf8f 100644 --- a/core/helpers.cpp +++ b/core/helpers.cpp @@ -512,6 +512,12 @@ bool SetRTPriorityRTKit(int prio) err = std::abs(err); WARN("Failed to set real-time priority: %s (%d)\n", std::strerror(err), err); } + /* Don't try to set the niceness for non-Linux systems. Standard POSIX has + * niceness as a per-process attribute, while the intent here is for the + * audio processing thread only to get a priority boost. Currently only + * Linux is known to have per-thread niceness. + */ +#ifdef __linux__ if(nicemin < 0) { TRACE("Making high priority with niceness %d\n", nicemin); @@ -521,7 +527,10 @@ bool SetRTPriorityRTKit(int prio) err = std::abs(err); WARN("Failed to set high priority: %s (%d)\n", std::strerror(err), err); } +#endif /* __linux__ */ + #else + WARN("D-Bus not supported\n"); #endif return false; |