Remove unused object pointer from condition vars, mutexes and thread vars
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 17 Feb 2008 16:29:16 +0000 (16:29 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 17 Feb 2008 16:29:16 +0000 (16:29 +0000)
include/vlc_modules_macros.h
include/vlc_threads.h
include/vlc_threads_funcs.h
src/misc/threads.c

index 567a344..0e544fd 100644 (file)
@@ -35,8 +35,8 @@
 /**
  * Current plugin ABI version
  */
-# define MODULE_SYMBOL 0_9_0f
-# define MODULE_SUFFIX "__0_9_0f"
+# define MODULE_SYMBOL 0_9_0g
+# define MODULE_SUFFIX "__0_9_0g"
 
 /*****************************************************************************
  * Add a few defines. You do not want to read this section. Really.
index 0065b4d..e35ce88 100644 (file)
@@ -133,8 +133,6 @@ typedef struct
     HANDLE              mutex;
     /* Win95/98/ME implementation */
     CRITICAL_SECTION    csection;
-
-    vlc_object_t * p_this;
 } vlc_mutex_t;
 
 typedef struct
@@ -147,8 +145,6 @@ typedef struct
     HANDLE              semaphore;
     CRITICAL_SECTION    csection;
     int                 i_win9x_cv;
-
-    vlc_object_t * p_this;
 } vlc_cond_t;
 
 typedef struct
@@ -167,16 +163,12 @@ typedef struct
 {
     int32_t         init;
     sem_id          lock;
-
-    vlc_object_t * p_this;
 } vlc_mutex_t;
 
 typedef struct
 {
     int32_t         init;
     thread_id       thread;
-
-    vlc_object_t * p_this;
 } vlc_cond_t;
 
 typedef struct
@@ -189,12 +181,10 @@ typedef pthread_t       vlc_thread_t;
 typedef struct
 {
     pthread_mutex_t mutex;
-    vlc_object_t * p_this;
 } vlc_mutex_t;
 typedef struct
 {
     pthread_cond_t cond;
-    vlc_object_t * p_this;
 } vlc_cond_t;
 
 typedef struct
index d2a27f5..abca389 100644 (file)
 /*****************************************************************************
  * Function definitions
  *****************************************************************************/
-VLC_EXPORT( int,  __vlc_mutex_init,    ( vlc_object_t *, vlc_mutex_t * ) );
-VLC_EXPORT( int,  __vlc_mutex_init_recursive, ( vlc_object_t *, vlc_mutex_t * ) );
+VLC_EXPORT( int,  __vlc_mutex_init,    ( vlc_mutex_t * ) );
+VLC_EXPORT( int,  __vlc_mutex_init_recursive, ( vlc_mutex_t * ) );
 VLC_EXPORT( void,  __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
-VLC_EXPORT( int,  __vlc_cond_init,     ( vlc_object_t *, vlc_cond_t * ) );
+VLC_EXPORT( int,  __vlc_cond_init,     ( vlc_cond_t * ) );
 VLC_EXPORT( void,  __vlc_cond_destroy,  ( const char *, int, vlc_cond_t * ) );
-VLC_EXPORT( int, __vlc_threadvar_create, (vlc_object_t *, vlc_threadvar_t * ) );
+VLC_EXPORT( int, __vlc_threadvar_create, (vlc_threadvar_t * ) );
 VLC_EXPORT( int,  __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( void * ), int, vlc_bool_t ) );
 VLC_EXPORT( int,  __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) );
 VLC_EXPORT( void, __vlc_thread_ready,  ( vlc_object_t * ) );
@@ -62,13 +62,13 @@ VLC_EXPORT( void, __vlc_thread_join,   ( vlc_object_t *, const char *, int ) );
  * vlc_mutex_init: initialize a mutex
  *****************************************************************************/
 #define vlc_mutex_init( P_THIS, P_MUTEX )                                   \
-    __vlc_mutex_init( VLC_OBJECT(P_THIS), P_MUTEX )
+    __vlc_mutex_init( P_MUTEX )
 
 /*****************************************************************************
  * vlc_mutex_init: initialize a recursive mutex (Don't use it)
  *****************************************************************************/
 #define vlc_mutex_init_recursive( P_THIS, P_MUTEX )                         \
-    __vlc_mutex_init_recursive( VLC_OBJECT(P_THIS), P_MUTEX )
+    __vlc_mutex_init_recursive( P_MUTEX )
 
 /*****************************************************************************
  * vlc_mutex_lock: lock a mutex
@@ -152,7 +152,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
  * vlc_cond_init: initialize a condition
  *****************************************************************************/
 #define vlc_cond_init( P_THIS, P_COND )                                     \
-    __vlc_cond_init( VLC_OBJECT(P_THIS), P_COND )
+    __vlc_cond_init( P_COND )
 
 /*****************************************************************************
  * vlc_cond_signal: start a thread on condition completion
@@ -497,7 +497,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
  * vlc_threadvar_create: create a thread-local variable
  *****************************************************************************/
 #define vlc_threadvar_create( PTHIS, P_TLS )                                 \
-   __vlc_threadvar_create( PTHIS, P_TLS )
+   __vlc_threadvar_create( P_TLS )
 
 /*****************************************************************************
  * vlc_threadvar_set: create: set the value of a thread-local variable
index b5dc103..9c5d05e 100644 (file)
@@ -253,10 +253,8 @@ int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
 /*****************************************************************************
  * vlc_mutex_init: initialize a mutex
  *****************************************************************************/
-int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
+int __vlc_mutex_init( vlc_mutex_t *p_mutex )
 {
-    p_mutex->p_this = p_this;
-
 #if defined( UNDER_CE )
     InitializeCriticalSection( &p_mutex->csection );
     return 0;
@@ -327,10 +325,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
 /*****************************************************************************
  * vlc_mutex_init: initialize a recursive mutex (Do not use)
  *****************************************************************************/
-int __vlc_mutex_init_recursive( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
+int __vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
 {
-    p_mutex->p_this = p_this;
-
 #if defined( WIN32 )
     /* Create mutex returns a recursive mutex */
     p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
@@ -353,9 +349,7 @@ int __vlc_mutex_init_recursive( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
     pthread_mutexattr_destroy( &attr );
     return( i_result );
 #else
-    msg_Err(p_this, "no recursive mutex found. Falling back to regular mutex.\n"
-                    "Expect hangs\n")
-    return __vlc_mutex_init( p_this, p_mutex );
+# error Unimplemented!
 #endif
 }
 
@@ -390,10 +384,8 @@ void __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mute
 /*****************************************************************************
  * vlc_cond_init: initialize a condition
  *****************************************************************************/
-int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
+int __vlc_cond_init( vlc_cond_t *p_condvar )
 {
-    p_condvar->p_this = p_this;
-
 #if defined( UNDER_CE )
     /* Initialize counter */
     p_condvar->i_waiting_threads = 0;
@@ -516,14 +508,12 @@ void __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condva
 /*****************************************************************************
  * vlc_tls_create: create a thread-local variable
  *****************************************************************************/
-int __vlc_threadvar_create( vlc_object_t *p_this, vlc_threadvar_t *p_tls )
+int __vlc_threadvar_create( vlc_threadvar_t *p_tls )
 {
     int i_ret = -1;
-    (void)p_this;
 
 #if defined( HAVE_KERNEL_SCHEDULER_H )
-    msg_Err( p_this, "TLS not implemented" );
-    i_ret VLC_EGENERIC;
+# error Unimplemented!
 #elif defined( UNDER_CE ) || defined( WIN32 )
 #elif defined( WIN32 )
     p_tls->handle = TlsAlloc();