<html><head></head><body>I don't know. I put the semaphore in replacement of the atomic variable. Ask Rafaël.<br><br><div class="gmail_quote">Le 20 février 2020 10:53:32 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Looks good to me.<br><br>Why was there semaphore in the first place ? For cancellation support ?<br><br>On Wed, Feb 19, 2020, at 18:29, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">pthread_join() already takes care of waiting for the joined thread to<br>terminate.<hr> src/android/thread.c | 19 +------------------<br> 1 file changed, 1 insertion(+), 18 deletions(-)<br><br>diff --git a/src/android/thread.c b/src/android/thread.c<br>index da128a769c..780183456d 100644<br>--- a/src/android/thread.c<br>+++ b/src/android/thread.c<br>@@ -133,7 +133,6 @@ void vlc_once(vlc_once_t *once, void (*cb)(void))<br> struct vlc_thread<br> {<br> pthread_t thread;<br>- vlc_sem_t finished;<br> <br> void *(*entry)(void*);<br> void *data;<br>@@ -183,25 +182,13 @@ static void *detached_thread(void *data)<br> return NULL;<br> }<br> <br>-static void finish_joinable_thread(void *data)<br>-{<br>- vlc_thread_t th = data;<br>-<br>- vlc_sem_post(&th->finished);<br>-}<br>-<br> static void *joinable_thread(void *data)<br> {<br> vlc_thread_t th = data;<br> void *ret;<br> <br>- vlc_cleanup_push(finish_joinable_thread, th);<br> thread = th;<br>- ret = th->entry(th->data);<br>- vlc_cleanup_pop();<br>- vlc_sem_post(&th->finished);<br>-<br>- return ret;<br>+ return th->entry(th->data);<br> }<br> <br> static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),<br>@@ -226,8 +213,6 @@ static int vlc_clone_attr (vlc_thread_t *th, void <br>*(*entry) (void *),<br> pthread_sigmask (SIG_BLOCK, &set, &oldset);<br> }<br> <br>- if (!detach)<br>- vlc_sem_init(&thread->finished, 0);<br> atomic_store(&thread->killed, false);<br> thread->killable = true;<br> thread->entry = entry;<br>@@ -258,8 +243,6 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) <br>(void *), void *data,<br> <br> void vlc_join (vlc_thread_t handle, void **result)<br> {<br>- vlc_sem_wait (&handle->finished);<br>-<br> int val = pthread_join (handle->thread, result);<br> VLC_THREAD_ASSERT ("joining thread");<br> clean_detached_thread(handle);<br>-- <br>2.25.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>