Commit 38f1bf27 authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/threads.c, include/vlc_threads_funcs.h: another bunch of fixes
   for the GNU-pth implementation.
parent 15f7b18e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides a portable threads implementation. * This header provides a portable threads implementation.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN * 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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@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, ...@@ -73,7 +73,7 @@ static inline int __vlc_mutex_lock( char * psz_file, int i_line,
const char * psz_error = ""; const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
i_result = st_mutex_lock( p_mutex->mutex ); i_result = st_mutex_lock( p_mutex->mutex );
...@@ -144,7 +144,7 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line, ...@@ -144,7 +144,7 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line,
const char * psz_error = ""; const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
i_result = st_mutex_unlock( p_mutex->mutex ); i_result = st_mutex_unlock( p_mutex->mutex );
...@@ -229,7 +229,7 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line, ...@@ -229,7 +229,7 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line,
const char * psz_error = ""; const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
i_result = st_cond_signal( p_condvar->cond ); i_result = st_cond_signal( p_condvar->cond );
...@@ -364,7 +364,7 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line, ...@@ -364,7 +364,7 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line,
const char * psz_error = ""; const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
i_result = st_cond_broadcast( p_condvar->cond ); i_result = st_cond_broadcast( p_condvar->cond );
...@@ -504,7 +504,8 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line, ...@@ -504,7 +504,8 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
const char * psz_error = ""; const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
st_mutex_unlock( p_mutex->mutex ); st_mutex_unlock( p_mutex->mutex );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client * threads.c : threads implementation for the VideoLAN client
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * 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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -95,7 +95,7 @@ int __vlc_threads_init( vlc_object_t *p_this ) ...@@ -95,7 +95,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
p_libvlc->b_ready = VLC_FALSE; p_libvlc->b_ready = VLC_FALSE;
#if defined( PTH_INIT_IN_PTH_H ) #if defined( PTH_INIT_IN_PTH_H )
i_ret = pth_init(); i_ret = ( pth_init() == FALSE );
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
i_ret = st_init(); i_ret = st_init();
...@@ -185,7 +185,7 @@ int __vlc_threads_end( vlc_object_t *p_this ) ...@@ -185,7 +185,7 @@ int __vlc_threads_end( vlc_object_t *p_this )
i_initializations--; i_initializations--;
if( i_initializations == 0 ) if( i_initializations == 0 )
{ {
return pth_kill(); return ( pth_kill() == FALSE );
} }
#elif defined( ST_INIT_IN_ST_H ) #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 ) ...@@ -260,7 +260,7 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
p_mutex->p_this = p_this; p_mutex->p_this = p_this;
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
p_mutex->mutex = st_mutex_new(); p_mutex->mutex = st_mutex_new();
...@@ -402,7 +402,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar ) ...@@ -402,7 +402,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
p_condvar->p_this = p_this; p_condvar->p_this = p_this;
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
p_condvar->cond = st_cond_new(); 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, ...@@ -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 ) #if defined( PTH_INIT_IN_PTH_H )
p_this->thread_id = pth_spawn( PTH_ATTR_DEFAULT, func, p_data ); 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 ) #elif defined( ST_INIT_IN_ST_H )
p_this->thread_id = st_thread_create( func, p_data, 1, 0 ); 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 ) ...@@ -734,7 +734,7 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line )
int i_ret = 0; int i_ret = 0;
#if defined( PTH_INIT_IN_PTH_H ) #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 ) #elif defined( ST_INIT_IN_ST_H )
i_ret = st_thread_join( p_this->thread_id, NULL ); i_ret = st_thread_join( p_this->thread_id, NULL );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment