[vlc-devel] commit: vlc_join: check for deadlock ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Aug 28 23:03:17 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Aug 28 23:57:08 2008 +0300| [0965ae7d651c32b206ed7aa92243d7fa497145c9] | committer: Rémi Denis-Courmont 

vlc_join: check for deadlock

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

 include/vlc_threads.h |    2 +-
 src/misc/threads.c    |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 76bb135..8f60d75 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -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
diff --git a/src/misc/threads.c b/src/misc/threads.c
index a296b4b..78efab1 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -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
 }
 




More information about the vlc-devel mailing list