summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-02-23 13:27:29 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-02-23 13:27:29 +0100
commit0c35b0e4dfb8149318c1343abc1f2805ec45ea84 (patch)
tree538a15ee87e12f1a0b7bd3cff583c8bf527996e7
parent48f303968adc4561d764e585e7da1b3a452d9c1c (diff)
fixed compile issue on multithread setups
-rw-r--r--zend/extensionpath.h2
-rw-r--r--zend/module.h22
2 files changed, 19 insertions, 5 deletions
diff --git a/zend/extensionpath.h b/zend/extensionpath.h
index 771ef24..c46319a 100644
--- a/zend/extensionpath.h
+++ b/zend/extensionpath.h
@@ -30,7 +30,7 @@ public:
* Constructor
* @param path
*/
- ExtensionPath(const char *path)
+ ExtensionPath(const char *path TSRMLS_DC)
{
// was an absole path given?
if (path[0] && path[0] == '/')
diff --git a/zend/module.h b/zend/module.h
index 11c88b7..8f3d832 100644
--- a/zend/module.h
+++ b/zend/module.h
@@ -44,6 +44,14 @@ private:
*/
zend_module_entry *_entry = nullptr;
+#ifdef ZTS
+ /**
+ * When in thread safety mode, we also keep track of the TSRM_LS var
+ * @var void***
+ */
+ void ***tsrm_ls;
+#endif
+
public:
/**
* Constructor
@@ -51,8 +59,16 @@ public:
*/
Module(const char *module)
{
+#ifdef ZTS
+ // fetch multi-threading thing
+ TSRMLS_FETCH();
+
+ // copy tsrm_ls param
+ this->tsrm_ls = tsrm_ls;
+#endif
+
// the path we're going to load
- ExtensionPath path(module);
+ ExtensionPath path(module TSRMLS_CC);
// load the module
_handle = DL_LOAD(module);
@@ -65,7 +81,7 @@ public:
// was the get_module() function found
if (!get_module) return;
-
+
// retrieve the module entry
_entry = get_module();
}
@@ -109,9 +125,7 @@ public:
_entry->module_number = zend_next_free_module();
_entry->handle = _handle;
- // we need the tsrm_ls variable
// @todo does loading an extension even work in a multi-threading setup?
- TSRMLS_FETCH();
// register the module, this apparently returns a copied entry pointer
auto *entry = zend_register_module_ex(_entry TSRMLS_CC);