Make fsock module thread-safe

This commit is contained in:
Sascha Schumann 1999-12-01 17:07:25 +00:00
parent 14382523bf
commit 94c36e8846
3 changed files with 73 additions and 38 deletions

View file

@ -850,16 +850,8 @@ static void php_new_thread_end_handler(THREAD_T thread_id)
static void core_globals_ctor(php_core_globals *core_globals)
{
memset(core_globals,0,sizeof(*core_globals));
zend_hash_init(&core_globals->ht_fsock_keys, 0, NULL, NULL, 1);
zend_hash_init(&core_globals->ht_fsock_socks, 0, NULL, (int (*)(void *))php_msock_destroy, 1);
}
static void core_globals_dtor(php_core_globals *core_globals)
{
zend_hash_destroy(&core_globals->ht_fsock_keys);
zend_hash_destroy(&core_globals->ht_fsock_socks);
}
#endif
@ -904,7 +896,7 @@ int php_module_startup(sapi_module_struct *sf)
#ifdef ZTS
tsrm_set_new_thread_end_handler(php_new_thread_end_handler);
executor_globals = ts_resource(executor_globals_id);
core_globals_id = ts_allocate_id(sizeof(php_core_globals), core_globals_ctor, core_globals_dtor);
core_globals_id = ts_allocate_id(sizeof(php_core_globals), core_globals_ctor, NULL);
core_globals = ts_resource(core_globals_id);
#endif
EG(error_reporting) = E_ALL & ~E_NOTICE;