#error You are not libvlc or one of its plugins. You cannot include this file
#endif
+#ifndef _VLC_THREADFUNCS_H_
+#define _VLC_THREADFUNCS_H_
+
/*****************************************************************************
* Function definitions
*****************************************************************************/
-VLC_EXPORT( int, __vlc_threads_init, ( vlc_object_t * ) );
-VLC_EXPORT( int, __vlc_threads_end, ( vlc_object_t * ) );
VLC_EXPORT( int, __vlc_mutex_init, ( vlc_object_t *, vlc_mutex_t * ) );
VLC_EXPORT( int, __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
VLC_EXPORT( int, __vlc_cond_init, ( vlc_object_t *, vlc_cond_t * ) );
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
+# define vlc_assert_locked( m ) \
+ assert (pthread_mutex_lock (&((m)->mutex)) == EDEADLK)
+
i_result = pthread_mutex_lock( &p_mutex->mutex );
if ( i_result )
{
return i_result;
}
+#ifndef vlc_assert_locked
+# define vlc_assert_locked( m ) (void)0
+#endif
+
/*****************************************************************************
* vlc_mutex_unlock: unlock a mutex
*****************************************************************************/
/*****************************************************************************
* vlc_threadvar_set: create: set the value of a thread-local variable
*****************************************************************************/
-#define vlc_threadvar_set( P_TLS , P_VAL ) \
- __vlc_threadvar_set( __FILE__, __LINE__, P_TLS, P_VAL )
-
-static inline int __vlc_threadvar_set( char* psz_file, int line,
- vlc_threadvar_t * p_tls, void *p_value )
+static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
{
int i_ret;
/*****************************************************************************
* vlc_threadvar_get: create: get the value of a thread-local variable
*****************************************************************************/
-#define vlc_threadvar_get( P_TLS ) \
- __vlc_threadvar_get( __FILE__, __LINE__, P_TLS )
-
-static inline void* __vlc_threadvar_get( char* psz_file, int line,
- vlc_threadvar_t * p_tls )
+static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
{
void* p_ret;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_ret = NULL;
#elif defined( UNDER_CE ) || defined( WIN32 )
- p_ret = TlsGetValue( &p_tls->handle );
+ p_ret = TlsGetValue( p_tls->handle );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
p_ret = pthread_getspecific( p_tls->handle );
*****************************************************************************/
#define vlc_thread_join( P_THIS ) \
__vlc_thread_join( VLC_OBJECT(P_THIS), __FILE__, __LINE__ )
+
+#endif