[vlc-commits] commit: Win32: implement thread return value ( =?UTF-8?Q?R=C3=A9mi=20Denis=2DCourmont=20?=)

git at videolan.org git at videolan.org
Sat Dec 4 18:23:41 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec  4 19:15:08 2010 +0200| [6bc9535c0a97e1ad3f8531ffd1dcbb5d565656ab] | committer: Rémi Denis-Courmont 

Win32: implement thread return value

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

 src/win32/thread.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 296013d..3650256 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -550,7 +550,7 @@ static unsigned __stdcall vlc_entry (void *p)
 
     vlc_threadvar_set (thread_key, th);
     th->killable = true;
-    th->entry (th->data);
+    th->data = th->entry (th->data);
     vlc_threadvar_cleanup ();
     if (th->detached)
         free (th);
@@ -628,10 +628,11 @@ void vlc_join (vlc_thread_t th, void **result)
                                                         == WAIT_IO_COMPLETION);
 
     CloseHandle (th->id);
-    assert (result == NULL); /* <- FIXME if ever needed */
 #ifdef UNDER_CE
     CloseHandle (th->cancel_event);
 #endif
+    if (result != NULL)
+        *result = th->data;
     free (th);
 }
 
@@ -694,6 +695,8 @@ void vlc_testcancel (void)
         /* Detached threads cannot be cancelled */
         assert (!th->detached);
 
+        th->data = NULL; /* TODO: special value? */
+
         for (vlc_cleanup_t *p = th->cleaners; p != NULL; p = p->next)
              p->proc (p->data);
         vlc_threadvar_cleanup ();



More information about the vlc-commits mailing list