mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04: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:
@@ -16,6 +16,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
and
|
and
|
||||||
[!1120](https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1120)
|
[!1120](https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1120)
|
||||||
have been merged.
|
have been merged.
|
||||||
|
- Prevented yabridge's ad-hoc socket acceptors from inheriting realtime
|
||||||
|
scheduling when spawned from audio threads. In practice this should not make
|
||||||
|
any difference as these threads are sleeping all the time except for under
|
||||||
|
very specific circumstances.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -780,6 +780,9 @@ class AdHocSocketHandler {
|
|||||||
Thread secondary_requests_handler([&]() {
|
Thread secondary_requests_handler([&]() {
|
||||||
pthread_setname_np(pthread_self(), "adhoc-acceptor");
|
pthread_setname_np(pthread_self(), "adhoc-acceptor");
|
||||||
|
|
||||||
|
// Any secondary threads should not be realtime
|
||||||
|
set_realtime_priority(false);
|
||||||
|
|
||||||
secondary_context.run();
|
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
|
* @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.
|
||||||
|
*
|
||||||
|
* 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;
|
bool set_realtime_priority(bool sched_fifo, int priority = 5) noexcept;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user