Commit 3c7cb167 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove Cthreads support

parent ef0b207a
......@@ -738,12 +738,8 @@ if test "${THREAD_LIB}" = "error"; then
THREAD_LIB=""
fi
dnl Check for cthreads under GNU/Hurd for instance
AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
VLC_ADD_LIBS([libvlc plugin],[${THREAD_LIB}])
dnl Don't link with rt when using GNU-pth
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.])
......@@ -837,7 +833,7 @@ AC_EGREP_HEADER(timespec,sys/time.h,[
dnl Check for threads library
if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
AC_CHECK_HEADERS(pthread.h kernel/scheduler.h kernel/OS.h)
fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
dnl Find where are the X headers and libraries
......
......@@ -59,9 +59,6 @@
/* This is not prototyped under Linux, though it exists. */
int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
#elif defined( HAVE_CTHREADS_H ) /* GNUMach */
# include <cthreads.h>
#else
# error no threads available on your system !
......@@ -213,37 +210,6 @@ typedef struct
pthread_key_t handle;
} vlc_threadvar_t;
#elif defined( HAVE_CTHREADS_H )
typedef cthread_t vlc_thread_t;
/* Those structs are the ones defined in /include/cthreads.h but we need
* to handle (&foo) where foo is a (mutex_t) while they handle (foo) where
* foo is a (mutex_t*) */
typedef struct
{
spin_lock_t held;
spin_lock_t lock;
char *name;
struct cthread_queue queue;
vlc_object_t * p_this;
} vlc_mutex_t;
typedef struct
{
spin_lock_t lock;
struct cthread_queue queue;
char *name;
struct cond_imp *implications;
vlc_object_t * p_this;
} vlc_cond_t;
typedef struct
{
cthread_key_t handle;
} vlc_threadvar_t;
#endif
#endif
#endif /* !_VLC_THREADS_H */
......@@ -140,10 +140,6 @@ static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
mutex_lock( p_mutex->mutex );
i_result = 0;
#endif
if( i_result )
......@@ -211,10 +207,6 @@ static inline int __vlc_mutex_unlock( const char * psz_file, int i_line,
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
mutex_unlock( p_mutex );
i_result = 0;
#endif
if( i_result )
......@@ -348,14 +340,6 @@ static inline int __vlc_cond_signal( const char * psz_file, int i_line,
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
i_result = 0;
#endif
if( i_result )
......@@ -527,10 +511,6 @@ static inline int __vlc_cond_wait( const char * psz_file, int i_line,
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
i_result = 0;
#endif
if( i_result )
......@@ -688,8 +668,6 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
errno = i_res;
}
#elif defined( HAVE_CTHREADS_H )
# error Unimplemented
#endif
if( i_res )
......@@ -731,8 +709,6 @@ static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_setspecific( p_tls->handle, p_value );
#elif defined( HAVE_CTHREADS_H )
i_ret = cthread_setspecific( p_tls->handle, p_value );
#endif
return i_ret;
......@@ -753,11 +729,6 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
p_ret = pthread_getspecific( p_tls->handle );
#elif defined( HAVE_CTHREADS_H )
if ( !cthread_getspecific( p_tls->handle, &p_ret ) )
{
p_ret = NULL;
}
#endif
return p_ret;
......
......@@ -70,7 +70,6 @@ static int i_win9x_cv = 1;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER;
#elif defined( HAVE_CTHREADS_H )
#endif
vlc_threadvar_t msg_context_global_key;
......@@ -114,7 +113,6 @@ int __vlc_threads_init( vlc_object_t *p_this )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_lock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
#endif
if( i_status == VLC_THREADS_UNINITIALIZED )
......@@ -145,7 +143,6 @@ int __vlc_threads_init( vlc_object_t *p_this )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
#elif defined( HAVE_CTHREADS_H )
#endif
p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_GLOBAL );
......@@ -180,8 +177,6 @@ int __vlc_threads_init( vlc_object_t *p_this )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_unlock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#endif
if( i_status != VLC_THREADS_READY )
......@@ -205,7 +200,6 @@ int __vlc_threads_end( vlc_object_t *p_this )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_lock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
#endif
if( i_initializations == 0 )
......@@ -223,7 +217,6 @@ int __vlc_threads_end( vlc_object_t *p_this )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_unlock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
#endif
return VLC_SUCCESS;
}
......@@ -300,10 +293,6 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
# endif
return pthread_mutex_init( &p_mutex->mutex, NULL );
#elif defined( HAVE_CTHREADS_H )
mutex_init( p_mutex );
return 0;
#endif
}
......@@ -382,9 +371,6 @@ int __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mutex
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
return 0;
#endif
if( i_result )
......@@ -490,15 +476,6 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
pthread_condattr_destroy (&attr);
return ret;
#elif defined( HAVE_CTHREADS_H )
/* condition_init() */
spin_lock_init( &p_condvar->lock );
cthread_queue_init( &p_condvar->queue );
p_condvar->name = 0;
p_condvar->implications = 0;
return 0;
#endif
}
......@@ -536,9 +513,6 @@ int __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condvar
errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
return 0;
#endif
if( i_result )
......@@ -569,8 +543,6 @@ int __vlc_threadvar_create( vlc_object_t *p_this, vlc_threadvar_t *p_tls )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_key_create( &p_tls->handle, NULL );
#elif defined( HAVE_CTHREADS_H )
i_ret = cthread_keycreate( &p_tls-handle );
#endif
return i_ret;
}
......@@ -671,10 +643,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
}
#endif
#elif defined( HAVE_CTHREADS_H )
p_priv->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
i_ret = 0;
#endif
if( i_ret == 0 )
......@@ -864,10 +832,6 @@ void __vlc_thread_join( vlc_object_t *p_this, const char * psz_file, int i_line
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_join( p_priv->thread_id, NULL );
#elif defined( HAVE_CTHREADS_H )
cthread_join( p_priv->thread_id );
i_ret = 1;
#endif
if( i_ret )
......
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