From 9495e2b8a9790ddc8c0d1e6b486aec60843ea74d Mon Sep 17 00:00:00 2001 From: Siva Mahadevan Date: Wed, 11 Mar 2026 14:00:05 -0400 Subject: [PATCH] pipewire/thread.c: only handle reset_on_fork if SCHED_RESET_ON_FORK is defined This fixes a missing definition error in thread.c: ../src/pipewire/thread.c:129:30: error: use of undeclared identifier 'SCHED_RESET_ON_FORK' 129 | SPA_FLAG_UPDATE(new_policy, SCHED_RESET_ON_FORK, reset_on_fork); --- src/pipewire/thread.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pipewire/thread.c b/src/pipewire/thread.c index 3af0b4a44..1637a8af7 100644 --- a/src/pipewire/thread.c +++ b/src/pipewire/thread.c @@ -92,9 +92,8 @@ static struct spa_thread *impl_create(void *object, pthread_t pt; pthread_attr_t *attr = NULL, attributes; const char *str; - int err, old_policy, new_policy; + int err; int (*create_func)(pthread_t *, const pthread_attr_t *attr, void *(*start)(void*), void *) = NULL; - struct sched_param sp; bool reset_on_fork = true; attr = pw_thread_fill_attr(props, &attributes); @@ -124,11 +123,19 @@ static struct spa_thread *impl_create(void *object, reset_on_fork = spa_atob(str); } +#ifdef SCHED_RESET_ON_FORK + int old_policy, new_policy; + struct sched_param sp; + pthread_getschedparam(pt, &old_policy, &sp); new_policy = old_policy; SPA_FLAG_UPDATE(new_policy, SCHED_RESET_ON_FORK, reset_on_fork); if (old_policy != new_policy) pthread_setschedparam(pt, new_policy, &sp); +#else + if (reset_on_fork) + pw_log_debug("SCHED_RESET_ON_FORK is not supported on this platform"); +#endif return (struct spa_thread*)pt; }