]> git.sesse.net Git - vlc/commitdiff
vlc_join is a cancellation point
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 27 Aug 2008 17:40:20 +0000 (20:40 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 27 Aug 2008 19:43:06 +0000 (22:43 +0300)
src/misc/threads.c

index 1f358e2b32517a01580f448c63b2c02eba6df360..69b9fd44697df0695c63ae2bc15847d9fca636a5 100644 (file)
@@ -595,6 +595,9 @@ void vlc_cancel (vlc_thread_t thread_id)
 
 /**
  * Waits for a thread to complete (if needed), and destroys it.
+ * This is a cancellation point; in case of cancellation, the join does _not_
+ * occur.
+ *
  * @param handle thread handle
  * @param p_result [OUT] pointer to write the thread return value or NULL
  * @return 0 on success, a standard error code otherwise.
@@ -605,7 +608,11 @@ int vlc_join (vlc_thread_t handle, void **result)
     return pthread_join (handle, result);
 
 #elif defined( UNDER_CE ) || defined( WIN32 )
-    WaitForSingleObject (handle->handle, INFINITE);
+    do
+        vlc_testcancel ();
+    while (WaitForSingleObjectEx (handle->handle, INFINITE, TRUE)
+                                                        == WAIT_IO_COMPLETION);
+
     CloseHandle (handle->handle);
     if (result)
         *result = handle->data;