mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Make fsock module thread-safe
This commit is contained in:
parent
14382523bf
commit
94c36e8846
3 changed files with 73 additions and 38 deletions
10
main/main.c
10
main/main.c
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue