ts_allocate_id and start_memory_manager problem.

From: Date: Tue, 31 Aug 1999 16:13:41 +0000
Subject: ts_allocate_id and start_memory_manager problem.
Groups: php.version4 
Request: Send a blank email to php-version4+get-3919@lists.php.net to get a copy of this message
hi andi, zeev, problem is: ts_allocate_id calls alloc_globals_ctor -> start_memory_manager -> start_memory_manager -> ALS_FETCH() *but* as ts_allocate_id hasn't returned a valid resource yet (still in the call) ALS_FETCH() will fetch the 1st allocated resource into alloc_globals. (bad idea). please let resources start with 1 instead of 0 - that would make debugging so much easier! tc ZEND_API void start_memory_manager(void) { ALS_FETCH(); AG(phead) = AG(head) = NULL; ...... static void alloc_globals_ctor(zend_alloc_globals *alloc_globals) { start_memory_manager(); } int zend_startup(zend_utility_functions *utility_functions, char **extensions) { #ifdef ZTS zend_compiler_globals *compiler_globals; zend_executor_globals *executor_globals; alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), alloc_globals_ctor, NULL); #endif ...... Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.version4 (#3919) next »