mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Prevent realtime scheduling for ad-hoc acceptors
I noticed that there were some realtime adhoc-acceptors running on my system. That should of course not happen, since these only exist to catch some sporadic (and likely as a result of a badly behaving plugin) mutual recursion on the audio thread.
This commit is contained in:
@@ -780,6 +780,9 @@ class AdHocSocketHandler {
|
||||
Thread secondary_requests_handler([&]() {
|
||||
pthread_setname_np(pthread_self(), "adhoc-acceptor");
|
||||
|
||||
// Any secondary threads should not be realtime
|
||||
set_realtime_priority(false);
|
||||
|
||||
secondary_context.run();
|
||||
});
|
||||
|
||||
|
||||
@@ -102,6 +102,12 @@ std::optional<int> get_realtime_priority() noexcept;
|
||||
*
|
||||
* @return Whether the operation was successful or not. This will fail if the
|
||||
* user does not have the privileges to set realtime priorities.
|
||||
*
|
||||
* TODO: At some point, consider using `SCHED_RESET_ON_FORK` instead of manually
|
||||
* disabling this when we don't want realtime scheduling to propagate.
|
||||
* That would require a bit of careful analysis because we do want it to
|
||||
* propagate to a Windows plugin's audio threads, and I don't think
|
||||
* there's a way to go back once you've set `SCHED_RESET_ON_FORK`.
|
||||
*/
|
||||
bool set_realtime_priority(bool sched_fifo, int priority = 5) noexcept;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user