might break the HP/UX or Solaris ports, please check if possible.
* ./src/misc/threads.c: fixed syntax in the st and pth implementations.
have_nanosleep=0
AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[
AC_CHECK_LIB(rt,nanosleep,
- [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"; have_nanosleep=1],
+ [pthread_LDFLAGS="${pthread_LDFLAGS} -lrt"; have_nanosleep=1],
[AC_CHECK_LIB(posix4,nanosleep,
- [vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4"; have_nanosleep=1])]
+ [pthread_LDFLAGS="${pthread_LDFLAGS} -lposix4"; have_nanosleep=1])]
)
])
if test x$have_nanosleep = x1; then
Define if nanosleep is available.)
fi
# HP/UX port
-AC_CHECK_LIB(rt,sem_init, [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"])
+AC_CHECK_LIB(rt,sem_init, [pthread_LDFLAGS="${pthread_LDFLAGS} -lrt"])
AC_CHECK_FUNC(inet_aton,,[
AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
dnl Check for pthreads - borrowed from XMMS
THREAD_LIB=error
if test "x${THREAD_LIB}" = "xerror"; then
- AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
+ AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread ${pthread_LDFLAGS}")
fi
if test "x${THREAD_LIB}" = "xerror"; then
- AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
+ AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads ${pthread_LDFLAGS}")
fi
if test "x${THREAD_LIB}" = "xerror"; then
AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
* This header provides portable declarations for mutexes & conditions
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
- * $Id: vlc_threads.h,v 1.10 2002/08/29 23:53:22 massiot Exp $
+ * $Id: vlc_threads.h,v 1.11 2002/08/30 12:23:23 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
} vlc_cond_t;
#elif defined( ST_INIT_IN_ST_H )
-typedef st_thread_t * vlc_thread_t;
+typedef st_thread_t vlc_thread_t;
typedef struct
{
- st_mutex_t * mutex;
+ st_mutex_t mutex;
vlc_object_t * p_this;
} vlc_mutex_t;
typedef struct
{
- st_cond_t * cond;
+ st_cond_t cond;
vlc_object_t * p_this;
} vlc_cond_t;
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
- * $Id: vlc_threads_funcs.h,v 1.1 2002/08/29 23:53:22 massiot Exp $
+ * $Id: vlc_threads_funcs.h,v 1.2 2002/08/30 12:23:23 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
i_result = pth_mutex_acquire( &p_mutex->mutex, TRUE, NULL );
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_mutex_lock( *p_mutex->mutex );
+ i_result = st_mutex_lock( p_mutex->mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
i_result = pth_mutex_release( &p_mutex->mutex );
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_mutex_unlock( *p_mutex->mutex );
+ i_result = st_mutex_unlock( p_mutex->mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
i_result = pth_cond_notify( &p_condvar->cond, FALSE );
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_cond_signal( *p_condvar->cond );
+ i_result = st_cond_signal( p_condvar->cond );
#elif defined( WIN32 )
/* Release one waiting thread if one is available. */
i_result = pth_cond_notify( &p_condvar->cond, FALSE );
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_cond_broadcast( *p_condvar->cond );
+ i_result = st_cond_broadcast( p_condvar->cond );
#elif defined( WIN32 )
/* Release all waiting threads. */
i_result = pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL );
#elif 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 );
+ st_mutex_unlock( p_mutex->mutex );
+ i_result = st_cond_wait( p_condvar->cond );
+ st_mutex_lock( p_mutex->mutex );
#elif defined( WIN32 )
if( !p_condvar->semaphore )
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: threads.c,v 1.13 2002/08/29 23:53:22 massiot Exp $
+ * $Id: threads.c,v 1.14 2002/08/30 12:23:23 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
return pth_mutex_init( &p_mutex->mutex );
#elif defined( ST_INIT_IN_ST_H )
- *p_mutex->mutex = st_mutex_new();
- return ( *p_mutex == NULL ) ? errno : 0;
+ p_mutex->mutex = st_mutex_new();
+ return ( p_mutex == NULL ) ? errno : 0;
#elif defined( WIN32 )
/* We use mutexes on WinNT/2K/XP because we can use the SignalObjectAndWait
pthread_mutexattr_init( &attr );
pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
- i_result = pthread_mutex_init( p_mutex, &attr );
+ i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
pthread_mutexattr_destroy( &attr );
return( i_result );
}
return 0;
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_mutex_destroy( *p_mutex );
+ i_result = st_mutex_destroy( p_mutex->mutex );
#elif defined( WIN32 )
if( p_mutex->mutex )
return pth_cond_init( &p_condvar->cond );
#elif defined( ST_INIT_IN_ST_H )
- *p_condvar->cond = st_cond_new();
- return ( *p_condvar->cond == NULL ) ? errno : 0;
+ p_condvar->cond = st_cond_new();
+ return ( p_condvar->cond == NULL ) ? errno : 0;
#elif defined( WIN32 )
/* Initialize counter */
return 0;
#elif defined( ST_INIT_IN_ST_H )
- i_result = st_cond_destroy( *p_condvar->cond );
+ i_result = st_cond_destroy( p_condvar->cond );
#elif defined( WIN32 )
if( !p_condvar->semaphore )