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
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.])
/* 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 )
/* 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 )
/* 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 )
/* 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 );
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;
{
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;
{
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;
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 )
/* 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() )
/* 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 )
/* 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 );
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 )
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 )
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;
/* 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 )
{
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;
/* 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 )
{
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 )
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;
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();
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 )