[vlc-commits] android thread: do not init the "finished" semaphore in the case of a detached thread.

Adrien Maglo git at videolan.org
Thu Jun 12 09:22:03 CEST 2014


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Jun 12 09:14:37 2014 +0200| [bb9e60e21a4c95f4721763fda3b8e5efc77011fd] | committer: Adrien Maglo

android thread: do not init the "finished" semaphore in the case of a detached thread.

This commit prevents the leak of the semaphore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb9e60e21a4c95f4721763fda3b8e5efc77011fd
---

 src/android/thread.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/android/thread.c b/src/android/thread.c
index dfbe920..1553073 100644
--- a/src/android/thread.c
+++ b/src/android/thread.c
@@ -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;



More information about the vlc-commits mailing list