Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c
| From: | Zeev Suraski | Date: | Thu, 05 Jun 2003 19:27:42 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-1342@lists.php.net to get a copy of this message | ||
At 16:39 04/06/2003, Thies C. Arntzen wrote:
i trust you;-) but - after looking thru zend.c - i think that
the TLS stuff is getting more and more un-maintainable.
It's not getting more and more unmaintainable - this particular pieces of code, in zend.c, are pretty much the way they were three years ago, with minor tweaks and fixes. In terms of volume of code, they haven't changed for years.
This is generally the way we do things, and if it isn't - it can be typically fixed without too much hassle. It's clearly the easiest way to develop and maintain things. The particular piece of code in zend.c is much trickier. We're initializing the infrastructure for making PHP in threaded environments tick, and since threaded environments are very different from multiprocess environments, there's some extra stuff we have to do. For example, here we don't just initialize the current thread's function table. We also initialize a process-wide function table, which serves as the read-only 'template' for creating new function tables every time a new thread gets started (we obviously don't need it in the Apache model, thanks to the wonders of fork()). This is something very much unique to zend.c (there are several cases of this happening there) - which is why you see this not-very-pleasant-looking piece of code. Have no worries though, as again, it's NOT growing :) Zeevi see no reason why we can't do the ZTS stuff always like:static void php_bla_init_globals(php_bla_globals *bla_globals_p TSRMLS_DC) {bla_globals_p->bla_thread_local = 0;} PHP_MINIT_FUNCTION(bla) {bla_real_global = "initialized here";#iffdef ZTSts_allocate_id(&bla_globals_id, sizeof(php_bla_globals), (ts_allocate_ctor) php_bla_init_globals, NULL);#elsephp_bla_init_globals(&bla_globals TSRMLS_CC);#endif as this would be so much easier to maintain and understand... yes - i know - that we don't have a PHP_MINIT_FUNCTION in Zend/* - but you can still see my point? just search for ZTS in zend.c and you'll see that the ZTS stuff has become very messy.