]> git.sesse.net Git - vlc/commitdiff
* ./configure.in: do not try to link with -lrt if not using pthreads. This
authorSam Hocevar <sam@videolan.org>
Fri, 30 Aug 2002 12:23:23 +0000 (12:23 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 30 Aug 2002 12:23:23 +0000 (12:23 +0000)
    might break the HP/UX or Solaris ports, please check if possible.
  * ./src/misc/threads.c: fixed syntax in the st and pth implementations.

configure.in
include/vlc_threads.h
include/vlc_threads_funcs.h
src/misc/threads.c

index 2d984a9f9007a1da682dc0531dbe52d76c804bdf..b046ee69a8b0fbf07ba05c3e9d8be0ca5e667df4 100644 (file)
@@ -156,9 +156,9 @@ AC_CHECK_FUNC(gethostbyname,,[
 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
@@ -166,7 +166,7 @@ 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")
@@ -203,10 +203,10 @@ AC_CHECK_LIB(m,pow,
 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")
index 4cda186a33d3fcac467686eb68c577b94728b62f..4b05a28b03383e5566cc2206d3e3de64c5596cf8 100644 (file)
@@ -3,7 +3,7 @@
  * 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>
@@ -105,15 +105,15 @@ typedef struct
 } 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;
 
index 707a0b749b3f5c88d4ce52596cb22870708bff66..1c35849576490b3c2b9b3bd6f5a91a82ba851003 100644 (file)
@@ -3,7 +3,7 @@
  * 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>
@@ -74,7 +74,7 @@ static inline int __vlc_mutex_lock( char * psz_file, int i_line,
     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 )
@@ -141,7 +141,7 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line,
     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 )
@@ -222,7 +222,7 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line,
     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. */
@@ -352,7 +352,7 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line,
     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. */
@@ -479,9 +479,9 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
     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 )
index 31ba463b8014738e2669967010f08e54464f10b6..cd664d1b7d06424c0c2cda000af98977519360c1 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
@@ -224,8 +224,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
     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
@@ -254,7 +254,7 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
 
         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 );
     }
@@ -303,7 +303,7 @@ int __vlc_mutex_destroy( char * psz_file, int i_line, vlc_mutex_t *p_mutex )
     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 )
@@ -357,8 +357,8 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
     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 */
@@ -441,7 +441,7 @@ int __vlc_cond_destroy( char * psz_file, int i_line, vlc_cond_t *p_condvar )
     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 )