diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 386b682ea74..9fb8abd3a4d 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -93,7 +93,12 @@ static FILE *tsrm_error_file; } #endif -#if defined(PTHREADS) +#if defined(GNUPTH) +static pth_key_t tls_key; +# define tsrm_tls_set(what) pth_key_setdata(tls_key, (void*)(what)) +# define tsrm_tls_get() pth_key_getdata(tls_key) + +#elif defined(PTHREADS) /* Thread local storage */ static pthread_key_t tls_key; # define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what)) @@ -125,6 +130,7 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu { #if defined(GNUPTH) pth_init(); + pth_key_create(&tls_key, 0); #elif defined(PTHREADS) pthread_key_create( &tls_key, 0 ); #elif defined(TSRM_ST)