summaryrefslogtreecommitdiff
path: root/ext/pcntl
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-03-12 14:15:47 +0300
committerDmitry Stogov <dmitry@zend.com>2019-03-12 14:15:47 +0300
commitf1b306fe117cfbbe69ab4ef9713d39ea068e74c0 (patch)
tree876485fc86d30924b161cd623919ddfc11a5c69a /ext/pcntl
parent5aa1176238f41097ea7295ba6911aa19ae7c1021 (diff)
downloadphp-git-f1b306fe117cfbbe69ab4ef9713d39ea068e74c0.tar.gz
Switch to use ZTS cache
Diffstat (limited to 'ext/pcntl')
-rw-r--r--ext/pcntl/config.m42
-rw-r--r--ext/pcntl/pcntl.c6
-rw-r--r--ext/pcntl/php_pcntl.h9
3 files changed, 12 insertions, 5 deletions
diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4
index 1c83a1b671..c9672de0fb 100644
--- a/ext/pcntl/config.m4
+++ b/ext/pcntl/config.m4
@@ -26,5 +26,5 @@ if test "$PHP_PCNTL" != "no"; then
AC_MSG_RESULT([no])
])
- PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli, $PCNTL_CFLAGS)
+ PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli, $PCNTL_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 1546e094f3..0176ef89e9 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -238,6 +238,9 @@ zend_module_entry pcntl_module_entry = {
};
#ifdef COMPILE_DL_PCNTL
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE()
+#endif
ZEND_GET_MODULE(pcntl)
#endif
@@ -576,6 +579,9 @@ static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
static PHP_GINIT_FUNCTION(pcntl)
{
+#if defined(COMPILE_DL_PCNTL) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
memset(pcntl_globals, 0, sizeof(*pcntl_globals));
}
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index 3a91233754..90ce2aea96 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -91,12 +91,13 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl)
zend_bool async_signals;
ZEND_END_MODULE_GLOBALS(pcntl)
-#ifdef ZTS
-#define PCNTL_G(v) TSRMG(pcntl_globals_id, zend_pcntl_globals *, v)
-#else
-#define PCNTL_G(v) (pcntl_globals.v)
+#if defined(ZTS) && defined(COMPILE_DL_PCNTL)
+ZEND_TSRMLS_CACHE_EXTERN()
#endif
+ZEND_EXTERN_MODULE_GLOBALS(pcntl)
+#define PCNTL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcntl, v)
+
#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT)
#endif /* PHP_PCNTL_H */