mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-13 05:33:55 -04:00
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);
This commit is contained in:
parent
7c5b5d12ed
commit
9495e2b8a9
1 changed files with 9 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue