mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Allow setting different priorities than 5
This commit is contained in:
@@ -41,8 +41,8 @@ std::optional<int> get_scheduling_priority() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_realtime_priority(bool sched_fifo) {
|
bool set_realtime_priority(bool sched_fifo, int priority) {
|
||||||
sched_param params{.sched_priority = 5};
|
sched_param params{.sched_priority = (sched_fifo ? priority : 0)};
|
||||||
return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER,
|
return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER,
|
||||||
¶ms) == 0;
|
¶ms) == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -44,14 +44,18 @@ boost::filesystem::path get_temporary_directory();
|
|||||||
std::optional<int> get_scheduling_priority();
|
std::optional<int> get_scheduling_priority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scheduling policy to `SCHED_FIFO` with priority 10 for this process.
|
* Set the scheduling policy to `SCHED_FIFO` with priority 5 for this process.
|
||||||
* We explicitly don't do this for wineserver itself since from my testing that
|
* We explicitly don't do this for wineserver itself since from my testing that
|
||||||
* can actually increase latencies.
|
* can actually increase latencies.
|
||||||
*
|
*
|
||||||
* @param sched_fifo If true, set the current process/thread's scheudling policy
|
* @param sched_fifo If true, set the current process/thread's scheudling policy
|
||||||
* to `SCHED_FIFO`. Otherwise reset it back to `SCHWED_OTHER`.
|
* to `SCHED_FIFO`. Otherwise reset it back to `SCHWED_OTHER`.
|
||||||
|
* @param priority The scheduling priority to use. The exact value usually
|
||||||
|
* doesn't really matter unless there are a lot of other active `SCHED_FIFO`
|
||||||
|
* background tasks. We'll use 5 as a default, but we'll periodically copy the
|
||||||
|
* priority set by the host on the audio threads.
|
||||||
*
|
*
|
||||||
* @return Whether the operation was successful or not. This will fail if the
|
* @return Whether the operation was successful or not. This will fail if the
|
||||||
* user does not have the privileges to set realtime priorities.
|
* user does not have the privileges to set realtime priorities.
|
||||||
*/
|
*/
|
||||||
bool set_realtime_priority(bool sched_fifo);
|
bool set_realtime_priority(bool sched_fifo, int priority = 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user