pipewire: module-rt: acquire_rt(): return error if thread not found

Instead of implicitly acting on the current thread if the provided thread
handle is unknown, return an error. This behaviour is not depended on inside
pipewire, and if needed, special casing e.g. `thread == NULL` could be added,
but any random `thread` value shouldn't affect the current thread.
This commit is contained in:
Barnabás Pőcze 2025-06-08 21:18:34 +02:00
parent a346a7d42e
commit 5ecf27681e

View file

@ -843,16 +843,17 @@ static int impl_acquire_rt(void *object, struct spa_thread *thread, int priority
pw_log_debug("SCHED_OTHER|SCHED_RESET_ON_FORK worked.");
}
params.priority = priority;
pthread_mutex_lock(&impl->lock);
if ((thr = find_thread_by_pt(impl, pt)) != NULL)
if ((thr = find_thread_by_pt(impl, pt)) != NULL) {
params.priority = priority;
params.tid = thr->tid;
else
params.tid = _gettid();
res = pw_loop_invoke(pw_thread_loop_get_loop(impl->thread_loop),
do_make_realtime, 0, &params, sizeof(params), false, impl);
}
else {
res = -ESRCH;
}
pthread_mutex_unlock(&impl->lock);
return res;