Fix segfault. Compile param --with-tsrm-pth=yes

This commit is contained in:
Evgeny Kalashnikov 2017-12-21 13:48:10 +01:00 committed by Anatol Belski
parent c2308d5d7c
commit a46f952c0f

View File

@ -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)