Commit 2b51a84f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Android: do not use semaphores from vlc_testcancel()

Taking any lock in vlc_testcancel() is prone to deadlock since it gets
called from vlc_cond_(timed)wait() with the mutex held.

Not using semaphores at all would probably be saner here though.
parent 1a5ea589
......@@ -330,14 +330,23 @@ static void *detached_thread(void *data)
return NULL;
}
static void finish_joinable_thread(void *data)
{
vlc_thread_t th = data;
vlc_sem_post(&th->finished);
}
static void *joinable_thread(void *data)
{
vlc_thread_t th = data;
void *ret;
vlc_cleanup_push(finish_joinable_thread, th);
thread = th;
ret = th->entry(th->data);
vlc_sem_post(&th->finished);
vlc_cleanup_run();
return ret;
}
......@@ -461,7 +470,6 @@ void vlc_testcancel (void)
if (!vlc_atomic_get(&thread->killed))
return;
vlc_sem_post(&thread->finished);
pthread_exit(NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment