]> git.sesse.net Git - vlc/commitdiff
android thread: do not init the "finished" semaphore in the case of a detached thread.
authorAdrien Maglo <magsoft@videolan.org>
Thu, 12 Jun 2014 07:14:37 +0000 (09:14 +0200)
committerAdrien Maglo <magsoft@videolan.org>
Thu, 12 Jun 2014 07:14:37 +0000 (09:14 +0200)
This commit prevents the leak of the semaphore.

src/android/thread.c

index dfbe9207ebc7eeb1a0f19eced44939390f8e45ad..155307381b80275aa260f41b65bd3ba977dd2c56 100644 (file)
@@ -372,8 +372,8 @@ static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),
         pthread_sigmask (SIG_BLOCK, &set, &oldset);
     }
 
-
-    vlc_sem_init(&thread->finished, 0);
+    if (!detach)
+        vlc_sem_init(&thread->finished, 0);
     atomic_store(&thread->killed, false);
     thread->killable = true;
     thread->cond = NULL;