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

Remove unused object pointer from condition vars, mutexes and thread vars

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