Commit 49a7dec5 authored by Clément Stenac's avatar Clément Stenac

Untested states thread and gnu portable threads implementation of tls

Fix Win32 implementation
parent 651078ec
......@@ -141,6 +141,7 @@ typedef struct
} vlc_cond_t;
typedef struct
{
int handle;
} vlc_threadvar_t;
#elif defined( ST_INIT_IN_ST_H )
......@@ -157,6 +158,7 @@ typedef struct
} vlc_cond_t;
typedef struct
{
int handle;
} vlc_threadvar_t;
#elif defined( WIN32 ) || defined( UNDER_CE )
......
......@@ -565,12 +565,15 @@ static inline int __vlc_threadvar_set( char* psz_file, int line,
{
int i_ret;
#if defined( PTH_INIT_IN_PTH_H ) || \
defined( ST_INIT_IN_ST_H ) || defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( PTH_INIT_IN_PTH_H )
return pth_key_setdata( p_tls->handle, p_value );
#elif defined( ST_INIT_IN_ST_H )
return st_thread_setspecific( p_tls->handle, p_value );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
return -1;
#elif defined( UNDER_CE ) || defined( WIN32 )
i_ret = ( TlsSetValue( &p_tls->handle, p_value ) != 0 );
i_ret = ( TlsSetValue( p_tls->handle, p_value ) != 0 );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_setspecific( p_tls->handle, p_value );
......@@ -593,10 +596,12 @@ static inline void* __vlc_threadvar_get( char* psz_file, int line,
{
void* p_ret;
#if defined( PTH_INIT_IN_PTH_H ) || \
defined( ST_INIT_IN_ST_H ) || defined( HAVE_KERNEL_SCHEDULER_H )
return NULL;
#if defined( PTH_INIT_IN_PTH_H )
p_ret = pth_key_getdata( p_handle->key );
#elif defined( ST_INIT_IN_ST_H )
p_ret = st_thread_getspecific( p_handle->key );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_ret = NULL;
#elif defined( UNDER_CE ) || defined( WIN32 )
p_ret = TlsGetValue( &p_tls->handle );
......
......@@ -506,11 +506,12 @@ int __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condvar
int __vlc_threadvar_create( vlc_object_t *p_this, vlc_threadvar_t *p_tls )
{
#if defined( PTH_INIT_IN_PTH_H )
return pth_key_create( &p_tls->handle, NULL );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( ST_INIT_IN_ST_H )
msg_Err( p_this, "TLS not implemented" );
return VLC_EGENERIC;
#elif defined( ST_INIT_IN_ST_H )
return st_key_create( &p_tls->handle, NULL );
#elif defined( UNDER_CE ) || defined( WIN32 )
#elif defined( WIN32 )
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