Re: [PHP4BETA] zend_list_addref() / zend_list_delete() question. (fwd)

From: Date: Tue, 05 Oct 1999 15:21:54 +0000
Subject: Re: [PHP4BETA] zend_list_addref() / zend_list_delete() question. (fwd)
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5199@lists.php.net to get a copy of this message
On Sat, 2 Oct 1999, Zeev Suraski wrote: > On Fri, 1 Oct 1999, Thies C. Arntzen wrote: > > > you might remember a few month ago (glory old PHP3 days) you told me that > > one must *not* call hash_apply (on "list") inside a destructor function > > for "list". (search for _php3_hash_apply in php3/functions/sybase.c - > > there's still a bug!). > > > > - to reduce my fuzz / let code speak - > > > > int _my_dtor(mytype *data) > > { > > zend_list_delete(data->parentid); > > } > > > > ... > > le_stmt = register_list_destructors(_my_dtor, NULL); > > ... > > > > i think we need to be able to support this - try to convert the dir.c to > > use resources and you'll see what i mean. > > Ok, some severe lack of sleep and it all comes back to me... > Yes, there's an inherent problem in touching ANY hash data structures from > a destructor of an element in that hash. The reason is simple - on hash > destruction, the hash performs a one-pass destruction&deallocation, and > its data structures are 'dirty' and unreliable at that time. > > I'll take your word for it if you say it's fairly required (e.g. in dir.c) > - I'm way too tired to check it myself. I'm vaguely thinking about an > alternative way to do this that would also be high-performance, I see if I > can come up with anything in the morning. zeev, i think we are sorted - 'cause the refcounting in zend is sooooo cool! the destructors for resources are called when teh symbol-table is cleared. zend_hash_destroy(&EG(symbol_table)); therby we are *allowed* to call zend_list_delete as often as we like (as that goes to "list")! am i right? tc > > > yeps - but i tink it would be nice to have functions in pairs (*_addref(), > > *_delref()) - but it would in fact be zend_list_delete(). > > > > for somebody looking at the c-code zend_list_delete() would look far more > > evil that seeing zend_list_addref() paired with zend_list_delref(). so > > it's just a question of taste. btw: zend_list_delete no longer really > > deletes... > > I guess #define zend_list_delref zend_list_delete in zend_list.h should do > the trick - it seems reasonable. > > Zeev > > -- > ----------------------------------------------------- > Zeev Suraski <zeev@zend.com> http://www.zend.com/ > For a PGP public key, finger bourbon@netvision.net.il > > > 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 (#5199) next »