]> git.sesse.net Git - vlc/commitdiff
* src/misc/threads.c, include/vlc_threads_funcs.h: another bunch of fixes
authorGildas Bazin <gbazin@videolan.org>
Sun, 2 Mar 2003 01:35:30 +0000 (01:35 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 2 Mar 2003 01:35:30 +0000 (01:35 +0000)
   for the GNU-pth implementation.

include/vlc_threads_funcs.h
src/misc/threads.c

index 8a8e33fab233221ad803315d0149d4fe096d264f..932cd0cd0af8e8990a5e10134c676cadf1c53bc5 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides a portable threads implementation.
  *****************************************************************************
  * Copyright (C) 1999, 2002 VideoLAN
- * $Id: vlc_threads_funcs.h,v 1.14 2003/03/01 23:26:08 gbazin Exp $
+ * $Id: vlc_threads_funcs.h,v 1.15 2003/03/02 01:35:30 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -73,7 +73,7 @@ static inline int __vlc_mutex_lock( char * psz_file, int i_line,
     const char * psz_error = "";
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_result = pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL );
+    i_result = ( pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     i_result = st_mutex_lock( p_mutex->mutex );
@@ -144,7 +144,7 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line,
     const char * psz_error = "";
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_result = pth_mutex_release( &p_mutex->mutex );
+    i_result = ( pth_mutex_release( &p_mutex->mutex ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     i_result = st_mutex_unlock( p_mutex->mutex );
@@ -229,7 +229,7 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line,
     const char * psz_error = "";
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_result = pth_cond_notify( &p_condvar->cond, FALSE );
+    i_result = ( pth_cond_notify( &p_condvar->cond, FALSE ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     i_result = st_cond_signal( p_condvar->cond );
@@ -364,7 +364,7 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line,
     const char * psz_error = "";
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_result = pth_cond_notify( &p_condvar->cond, FALSE );
+    i_result = ( pth_cond_notify( &p_condvar->cond, TRUE ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     i_result = st_cond_broadcast( p_condvar->cond );
@@ -504,7 +504,8 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
     const char * psz_error = "";
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_result = pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL );
+    i_result = ( pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL )
+                 == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     st_mutex_unlock( p_mutex->mutex );
index b4be438c8481a573fc99ce056772f03d16e73f81..939e5f306b4ebdb53c204bc7a17a5b14efe162b2 100644 (file)
@@ -2,7 +2,7 @@
  * threads.c : threads implementation for the VideoLAN client
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: threads.c,v 1.37 2003/03/01 23:26:08 gbazin Exp $
+ * $Id: threads.c,v 1.38 2003/03/02 01:35:30 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -95,7 +95,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
         p_libvlc->b_ready = VLC_FALSE;
 
 #if defined( PTH_INIT_IN_PTH_H )
-        i_ret = pth_init();
+        i_ret = ( pth_init() == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
         i_ret = st_init();
@@ -185,7 +185,7 @@ int __vlc_threads_end( vlc_object_t *p_this )
     i_initializations--;
     if( i_initializations == 0 )
     {
-        return pth_kill();
+        return ( pth_kill() == FALSE );
     }
 
 #elif defined( ST_INIT_IN_ST_H )
@@ -260,7 +260,7 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
     p_mutex->p_this = p_this;
 
 #if defined( PTH_INIT_IN_PTH_H )
-    return pth_mutex_init( &p_mutex->mutex );
+    return ( pth_mutex_init( &p_mutex->mutex ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     p_mutex->mutex = st_mutex_new();
@@ -402,7 +402,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
     p_condvar->p_this = p_this;
 
 #if defined( PTH_INIT_IN_PTH_H )
-    return pth_cond_init( &p_condvar->cond );
+    return ( pth_cond_init( &p_condvar->cond ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     p_condvar->cond = st_cond_new();
@@ -574,7 +574,7 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
 
 #if defined( PTH_INIT_IN_PTH_H )
     p_this->thread_id = pth_spawn( PTH_ATTR_DEFAULT, func, p_data );
-    i_ret = 0;
+    i_ret = p_this->thread_id == NULL;
 
 #elif defined( ST_INIT_IN_ST_H )
     p_this->thread_id = st_thread_create( func, p_data, 1, 0 );
@@ -734,7 +734,7 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line )
     int i_ret = 0;
 
 #if defined( PTH_INIT_IN_PTH_H )
-    i_ret = pth_join( p_this->thread_id, NULL );
+    i_ret = ( pth_join( p_this->thread_id, NULL ) == FALSE );
 
 #elif defined( ST_INIT_IN_ST_H )
     i_ret = st_thread_join( p_this->thread_id, NULL );