]> git.sesse.net Git - vlc/commitdiff
vlc_join: check for deadlock
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Thu, 28 Aug 2008 20:57:08 +0000 (23:57 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Thu, 28 Aug 2008 21:03:12 +0000 (00:03 +0300)
include/vlc_threads.h
src/misc/threads.c

index 76bb135f0daf0890d4c967886182ae9b4a682151..8f60d75ca337a3d43ae114f10cd19efc7972bc7b 100644 (file)
@@ -179,7 +179,7 @@ VLC_EXPORT( void, __vlc_thread_join,   ( vlc_object_t *, const char *, int ) );
 
 VLC_EXPORT( int, vlc_clone, (vlc_thread_t *, void * (*) (void *), void *, int) );
 VLC_EXPORT( void, vlc_cancel, (vlc_thread_t) );
-VLC_EXPORT( int, vlc_join, (vlc_thread_t, void **) );
+VLC_EXPORT( void, vlc_join, (vlc_thread_t, void **) );
 VLC_EXPORT (void, vlc_control_cancel, (int cmd, ...));
 
 #ifndef LIBVLC_USE_PTHREAD_CANCEL
index a296b4b12c289f1a6b80e24ebee2dd7883f105de..78efab1a84ed1d76900f1ab9233b2599e48a0239 100644 (file)
@@ -621,10 +621,12 @@ void vlc_cancel (vlc_thread_t thread_id)
  * @param p_result [OUT] pointer to write the thread return value or NULL
  * @return 0 on success, a standard error code otherwise.
  */
-int vlc_join (vlc_thread_t handle, void **result)
+void vlc_join (vlc_thread_t handle, void **result)
 {
 #if defined( LIBVLC_USE_PTHREAD )
-    return pthread_join (handle, result);
+    int val = pthread_join (handle, result);
+    if (val)
+        vlc_pthread_fatal ("joining thread", val, __FILE__, __LINE__);
 
 #elif defined( UNDER_CE ) || defined( WIN32 )
     do
@@ -636,15 +638,13 @@ int vlc_join (vlc_thread_t handle, void **result)
     if (result)
         *result = handle->data;
     free (handle);
-    return 0;
 
 #elif defined( HAVE_KERNEL_SCHEDULER_H )
     int32_t exit_value;
-    ret = (B_OK == wait_for_thread( p_priv->thread_id, &exit_value ));
-    if( !ret && result )
+    int val = (B_OK == wait_for_thread( p_priv->thread_id, &exit_value ));
+    if( !val && result )
         *result = (void *)exit_value;
 
-    return ret;
 #endif
 }