summaryrefslogtreecommitdiff
path: root/phpcpp.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-25 10:35:12 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-25 10:35:12 +0100
commitaf85f97c832ba318373db3ad6df72ebedbad1a1d (patch)
treee5beabe1756207893b869c5213a02f98a50d25d6 /phpcpp.h
parent811c83de9e6410435b6b9c10b058b04b2fcae5c3 (diff)
ZTS thread safety is now automatically detected when PHP-CPP is installed
Diffstat (limited to 'phpcpp.h')
-rw-r--r--phpcpp.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/phpcpp.h b/phpcpp.h
index 17778f4..86828a4 100644
--- a/phpcpp.h
+++ b/phpcpp.h
@@ -23,12 +23,30 @@
#include <map>
/**
- * Disable TSRM for now
+ * Include PHP config
*/
-#define TSRMLS_C
-#define TSRMLS_CC
-#define TSRMLS_D
-#define TSRMLS_DC
+#include <phpcpp/config.h>
+
+/**
+ * Is ZTS enabled?
+ */
+#ifdef ZTS
+
+ // enable TSRM
+# define TSRMLS_C tsrm_ls
+# define TSRMLS_CC ,tsrm_ls
+# define TSRMLS_D void ***tsrm_ls
+# define TSRMLS_DC ,void ***tsrm_ls
+
+#else
+
+ // disable TSRM
+# define TSRMLS_C
+# define TSRMLS_CC
+# define TSRMLS_D
+# define TSRMLS_DC
+
+#endif
/**
* Include all headers files that are related to this library