summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-08-13 21:03:27 +0000
committerZeev Suraski <zeev@php.net>1999-08-13 21:03:27 +0000
commit58e24ac18a06944791cebf606042e92128abc7b7 (patch)
treeb37103a4c8ec02a83bb0230211d68188ceadfcdb /main/main.c
parent5ae3f32b24b45512c96e89ff3162725ddef09cc8 (diff)
downloadphp-git-58e24ac18a06944791cebf606042e92128abc7b7.tar.gz
- Add PHP Modules workspace
- Get the MySQL module to compile&work under thread-safe Win32 - Fix various thread safety issues with dynamic modules
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/main/main.c b/main/main.c
index 15fa76ac65..63f0519f21 100644
--- a/main/main.c
+++ b/main/main.c
@@ -96,9 +96,6 @@ void *gLock; /*mutex variable */
/* True globals (no need for thread safety) */
HashTable configuration_hash;
PHPAPI char *php3_ini_path = NULL;
-#ifdef ZTS
-php_core_globals *main_core_globals=NULL;
-#endif
#define SAFE_FILENAME(f) ((f)?(f):"-")
@@ -755,20 +752,17 @@ static void php3_config_ini_shutdown()
}
-#ifdef ZTS
-static void core_globals_ctor(php_core_globals *core_globals)
+static int zend_body_write_wrapper(const char *str, uint str_length)
{
- if (main_core_globals) {
- *core_globals = *main_core_globals;
- }
+ return zend_body_write(str, str_length);
}
-#endif
-
-static int zend_body_write_wrapper(const char *str, uint str_length)
+#ifdef ZTS
+static void php_new_thread_end_handler(THREAD_T thread_id)
{
- return zend_body_write(str, str_length);
+ php_ini_refresh_caches();
}
+#endif
int php_module_startup(sapi_module_struct *sf)
@@ -810,10 +804,11 @@ int php_module_startup(sapi_module_struct *sf)
zuf.get_ini_entry = php_get_ini_entry_for_zend;
zend_startup(&zuf, NULL);
+ tsrm_set_new_thread_end_handler(php_new_thread_end_handler);
+
#ifdef ZTS
- core_globals_id = ts_allocate_id(sizeof(php_core_globals), core_globals_ctor, NULL);
+ core_globals_id = ts_allocate_id(sizeof(php_core_globals), NULL, NULL);
core_globals = ts_resource(core_globals_id);
- main_core_globals = core_globals;
#endif
PG(header_is_being_sent) = 0;
@@ -835,11 +830,12 @@ int php_module_startup(sapi_module_struct *sf)
le_index_ptr = _register_list_destructors(NULL, NULL, 0);
FREE_MUTEX(gLock);
+ php_ini_mstartup();
+
if (php3_config_ini_startup() == FAILURE) {
return FAILURE;
}
- php_ini_mstartup();
REGISTER_INI_ENTRIES();
zuv.short_tags = (unsigned char) PG(short_tags);