summaryrefslogtreecommitdiff
path: root/TSRM/TSRM.c
diff options
context:
space:
mode:
authorEvgeny Kalashnikov <kenbo@prola.ru>2017-12-21 13:48:10 +0100
committerAnatol Belski <ab@php.net>2017-12-21 13:48:10 +0100
commita46f952c0ffe4ea9436699fbaa91e8c6cdb319b0 (patch)
treed7d63b9f17a2d030d4ca6cb239c5ec5df7ee1698 /TSRM/TSRM.c
parentc2308d5d7cb281b2e2b36774bbc4863429fab0bc (diff)
downloadphp-git-a46f952c0ffe4ea9436699fbaa91e8c6cdb319b0.tar.gz
Fix segfault. Compile param --with-tsrm-pth=yes
Diffstat (limited to 'TSRM/TSRM.c')
-rw-r--r--TSRM/TSRM.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 386b682ea7..9fb8abd3a4 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)