Re: cleanups (destructors-functions MUST return a value)

From: Date: Fri, 30 Apr 1999 10:16:56 +0000
Subject: Re: cleanups (destructors-functions MUST return a value)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-5295@lists.php.net to get a copy of this message
On Fri, 30 Apr 1999, Thies C. Arntzen wrote: > currently working on one of the sporadic crashes when using ora_** > calls.... (i'm sure there's more stuff like this in some other modules)... > > > 1. is it right that ALL descructor functions don't need a to return a > value (stuff that gets registred with register_descructior)?? -> 'cause > hash_destroy will be called for them.... It's true. > 2. if you call _php3_hash_apply the supplied function MUST return a > value (not sure if this is the case in all current modules!!!) That's also true. The function pointer supplied to hash_apply is expected to return an int. If the return value is true, after running the function on the element, that element is also destroyed (if there's a registered destructor function for it, it *WILL* be called, so your apply-function mustn't destroy it as well!) > 3. you should NOT call _php3_hash_apply on the same HashTable if you're > already in the descructor function for that table!!! Absolutely true, any resource you register in a hash table (in that case, the resource list table) that has a destructor - must never be explicitly destructed by you, since sooner or later, it will be destructed when the hash is destroyed. > question: how can i influence the order in which HashTables get destructed > (cursors BEFORE connections etc) in a save way -> the way it's currently > done is NOT save as we can see from the gdb-trace!! There's no way you can influence the order in which elements in the hash are destroyed, after all, it is a hash :) Your only option is registering just the 'absolute parent' in the resource list, and putting all the necessary pointers to any related children in that parent, so the parent's destructor can destroy them in the right order. Zeev -- ----------------------------------------------------- Zeev Suraski <zeev@zend.com> For a PGP public key, finger bourbon@netvision.net.il -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5295) next »