mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
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:
parent
a346a7d42e
commit
5ecf27681e
1 changed files with 7 additions and 6 deletions
|
|
@ -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, ¶ms, sizeof(params), false, impl);
|
||||
}
|
||||
else {
|
||||
res = -ESRCH;
|
||||
}
|
||||
pthread_mutex_unlock(&impl->lock);
|
||||
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue