Commit 8b672857 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove support for GNU Portable Threads

parent 0635a37b
......@@ -741,25 +741,6 @@ fi
dnl Check for cthreads under GNU/Hurd for instance
AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
dnl
dnl GNU portable threads
dnl
AC_ARG_ENABLE(pth,
[ --enable-pth GNU Pth support (default disabled)],
[ if test "${enable_pth}" = "yes"; then
AC_CHECK_LIB(pth,pth_init)
AC_MSG_CHECKING(for pth_init in pth.h)
AC_EGREP_HEADER(pth_init,pth.h,[
AC_MSG_RESULT(yes)
AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
Define if <pth.h> defines pth_init)
THREAD_LIB="-lpth"
],[
AC_MSG_RESULT(no)
])
fi
])
dnl
dnl State Threads
dnl
......@@ -782,7 +763,7 @@ AC_ARG_ENABLE(st,
VLC_ADD_LIBS([libvlc plugin],[${THREAD_LIB}])
dnl Don't link with rt when using GNU-pth
if test "${THREAD_LIB}" != "-lpth" && test "${THREAD_LIB}" != "-lst"; then
if test "${THREAD_LIB}" != "-lst"; then
AC_CHECK_LIB(rt, clock_nanosleep, [
VLC_ADD_LIBS([libvlc],[-lrt])
AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
......
......@@ -38,10 +38,7 @@
# include <sys/time.h>
#endif
#if defined( PTH_INIT_IN_PTH_H ) /* GNU Pth */
# include <pth.h>
#elif defined( ST_INIT_IN_ST_H ) /* State threads */
#if defined( ST_INIT_IN_ST_H ) /* State threads */
# include <st.h>
#elif defined( UNDER_CE )
......@@ -130,24 +127,7 @@
* Type definitions
*****************************************************************************/
#if defined( PTH_INIT_IN_PTH_H )
typedef pth_t vlc_thread_t;
typedef struct
{
pth_mutex_t mutex;
vlc_object_t * p_this;
} vlc_mutex_t;
typedef struct
{
pth_cond_t cond;
vlc_object_t * p_this;
} vlc_cond_t;
typedef struct
{
int handle;
} vlc_threadvar_t;
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
typedef st_thread_t vlc_thread_t;
typedef struct
{
......
......@@ -100,10 +100,7 @@ static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
/* In case of error : */
unsigned long int i_thread = 0;
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_result = st_mutex_lock( p_mutex->mutex );
#elif defined( UNDER_CE )
......@@ -179,10 +176,7 @@ static inline int __vlc_mutex_unlock( const char * psz_file, int i_line,
/* In case of error : */
unsigned long int i_thread = 0;
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_release( &p_mutex->mutex ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_result = st_mutex_unlock( p_mutex->mutex );
#elif defined( UNDER_CE )
......@@ -265,10 +259,7 @@ static inline int __vlc_cond_signal( const char * psz_file, int i_line,
/* In case of error : */
unsigned long int i_thread = 0;
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_notify( &p_condvar->cond, FALSE ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_result = st_cond_signal( p_condvar->cond );
#elif defined( UNDER_CE )
......@@ -400,11 +391,7 @@ static inline int __vlc_cond_wait( const char * psz_file, int i_line,
/* In case of error : */
unsigned long int i_thread = 0;
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL )
== FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
st_mutex_unlock( p_mutex->mutex );
i_result = st_cond_wait( p_condvar->cond );
st_mutex_lock( p_mutex->mutex );
......@@ -588,9 +575,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
int i_res;
unsigned long int i_thread = 0;
#if defined( PTH_INIT_IN_PTH_H )
# error Unimplemented
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
# error Unimplemented
#elif defined( UNDER_CE )
mtime_t delay_ms = (deadline - mdate())/1000;
......@@ -753,9 +738,7 @@ static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
{
int i_ret;
#if defined( PTH_INIT_IN_PTH_H )
return pth_key_setdata( p_tls->handle, p_value );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
return st_thread_setspecific( p_tls->handle, p_value );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
return -1;
......@@ -780,9 +763,7 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
{
void* p_ret;
#if defined( PTH_INIT_IN_PTH_H )
p_ret = pth_key_getdata( p_handle->key );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
p_ret = st_thread_getspecific( p_handle->key );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_ret = NULL;
......
......@@ -35,11 +35,6 @@
#include <assert.h>
#include <errno.h>
#if defined( PTH_INIT_IN_PTH_H ) /* GNU Pth */
# include <pth.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h> /* select() */
#endif
......@@ -331,9 +326,6 @@ void msleep( mtime_t delay )
#elif defined( HAVE_KERNEL_OS_H )
snooze( delay );
#elif defined( PTH_INIT_IN_PTH_H )
pth_usleep( delay );
#elif defined( ST_INIT_IN_ST_H )
st_usleep( delay );
......
......@@ -44,8 +44,7 @@ static volatile unsigned i_initializations = 0;
static volatile int i_status = VLC_THREADS_UNINITIALIZED;
static vlc_object_t *p_root;
#if defined( PTH_INIT_IN_PTH_H )
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
......@@ -105,8 +104,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* If we have lazy mutex initialization, use it. Otherwise, we just
* hope nothing wrong happens. */
#if defined( PTH_INIT_IN_PTH_H )
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
if( IsDebuggerPresent() )
......@@ -128,10 +126,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* We should be safe now. Do all the initialization stuff we want. */
p_libvlc_global->b_ready = VLC_FALSE;
#if defined( PTH_INIT_IN_PTH_H )
i_ret = ( pth_init() == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_ret = st_init();
#elif defined( UNDER_CE )
......@@ -182,9 +177,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* If we have lazy mutex initialization support, unlock the mutex;
* otherwize, do a naive wait loop. */
#if defined( PTH_INIT_IN_PTH_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( UNDER_CE )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
......@@ -214,8 +207,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
int __vlc_threads_end( vlc_object_t *p_this )
{
(void)p_this;
#if defined( PTH_INIT_IN_PTH_H )
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
......@@ -234,13 +226,7 @@ int __vlc_threads_end( vlc_object_t *p_this )
vlc_object_destroy( p_root );
}
#if defined( PTH_INIT_IN_PTH_H )
if( i_initializations == 0 )
{
return ( pth_kill() == FALSE );
}
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
......@@ -259,10 +245,7 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
assert( p_this );
p_mutex->p_this = p_this;
#if defined( PTH_INIT_IN_PTH_H )
return ( pth_mutex_init( &p_mutex->mutex ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
p_mutex->mutex = st_mutex_new();
return ( p_mutex->mutex == NULL ) ? errno : 0;
......@@ -380,10 +363,7 @@ int __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mutex
/* In case of error : */
int i_thread = -1;
#if defined( PTH_INIT_IN_PTH_H )
return 0;
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_result = st_mutex_destroy( p_mutex->mutex );
#elif defined( UNDER_CE )
......@@ -440,10 +420,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 ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
p_condvar->cond = st_cond_new();
return ( p_condvar->cond == NULL ) ? errno : 0;
......@@ -554,10 +531,7 @@ int __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condvar
/* In case of error : */
int i_thread = -1;
#if defined( PTH_INIT_IN_PTH_H )
return 0;
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_result = st_cond_destroy( p_condvar->cond );
#elif defined( UNDER_CE )
......@@ -607,9 +581,8 @@ int __vlc_threadvar_create( vlc_object_t *p_this, vlc_threadvar_t *p_tls )
{
int i_ret = -1;
(void)p_this;
#if defined( PTH_INIT_IN_PTH_H )
i_ret = pth_key_create( &p_tls->handle, NULL );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( HAVE_KERNEL_SCHEDULER_H )
msg_Err( p_this, "TLS not implemented" );
i_ret VLC_EGENERIC;
#elif defined( ST_INIT_IN_ST_H )
......@@ -643,11 +616,7 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
vlc_mutex_lock( &p_this->object_lock );
#if defined( PTH_INIT_IN_PTH_H )
p_priv->thread_id = pth_spawn( PTH_ATTR_DEFAULT, func, p_data );
i_ret = p_priv->thread_id == NULL;
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
p_priv->thread_id = st_thread_create( func, p_data, 1, 0 );
i_ret = 0;
......@@ -780,7 +749,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, const char * psz_file,
int i_line, int i_priority )
{
vlc_object_internals_t *p_priv = p_this->p_internals;
#if defined( PTH_INIT_IN_PTH_H ) || defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
#elif defined( WIN32 ) || defined( UNDER_CE )
if( !p_priv->thread_id.hThread )
p_priv->thread_id.hThread = GetCurrentThread();
......@@ -918,10 +887,7 @@ void __vlc_thread_join( vlc_object_t *p_this, const char * psz_file, int i_line
int i_ret = 0;
#if defined( PTH_INIT_IN_PTH_H )
i_ret = ( pth_join( p_priv->thread_id, NULL ) == FALSE );
#elif defined( ST_INIT_IN_ST_H )
#if defined( ST_INIT_IN_ST_H )
i_ret = st_thread_join( p_priv->thread_id, NULL );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
......
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