cvs: /php4 main.c
| From: | Sascha Schumann | Date: | Fri, 08 Oct 1999 16:25:02 +0000 |
| Subject: | cvs: /php4 main.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-5413@lists.php.net to get a copy of this message | ||
sas Fri Oct 8 12:25:02 1999 EDT
Modified files:
/php4 main.c
Log:
Implement temporary workaround for thread-safety issues. This
serializes all request accesses. To disable, define NO_GLOBAL_LOCK
Index: php4/main.c
diff -u php4/main.c:1.127 php4/main.c:1.128
--- php4/main.c:1.127 Mon Oct 4 06:39:32 1999
+++ php4/main.c Fri Oct 8 12:24:31 1999
@@ -19,7 +19,7 @@
*/
-/* $Id: main.c,v 1.127 1999/10/04 10:39:32 thies Exp $ */
+/* $Id: main.c,v 1.128 1999/10/08 16:24:31 sas Exp $ */
#include <stdio.h>
@@ -88,6 +88,21 @@
PHPAPI int core_globals_id;
#endif
+/* temporary workaround for thread-safety issues in libzend */
+#if defined(ZTS) && !defined(NO_GLOBAL_LOCK)
+static THREAD_T global_lock;
+#define global_lock() tsrm_mutex_lock(global_lock)
+#define global_unlock() tsrm_mutex_unlock(global_lock);
+#define global_lock_init() global_lock = tsrm_mutex_alloc()
+#define global_lock_destroy() tsrm_mutex_free(global_lock)
+#else
+#define global_lock()
+#define global_unlock()
+#define global_lock_init()
+#define global_lock_destroy()
+#endif
+
+
void _php3_build_argv(char * ELS_DC);
static void php3_timeout(int dummy);
static void php3_set_timeout(long seconds);
@@ -661,6 +676,8 @@
int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
{
+ global_lock();
+
php_output_startup();
if (PG(output_buffering)) {
@@ -760,6 +777,8 @@
request_info.php_argv0 = NULL;
}
#endif
+
+ global_unlock();
}
@@ -822,6 +841,7 @@
WSADATA wsaData;
#endif
+ global_lock_init();
SG(server_context) = NULL;
SG(request_info).request_method = NULL;
sapi_activate(SLS_C);
@@ -935,6 +955,7 @@
sapi_rqst->flush(sapi_rqst->scid);
#endif
+ global_lock_destroy();
zend_shutdown();
UNREGISTER_INI_ENTRIES();
php_ini_mshutdown();