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.
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;
}
if (!vlc_atomic_get(&thread->killed))
return;
- vlc_sem_post(&thread->finished);
pthread_exit(NULL);
}