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

From: Date: Fri, 01 Oct 1999 18:08:53 +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-5072@lists.php.net to get a copy of this message
On Fri, 1 Oct 1999, Thies C. Arntzen wrote: > here you go - > > > ---------- Forwarded message ---------- > Date: Thu, 30 Sep 1999 11:06:58 +0200 (CEST) > From: Thies C. Arntzen <thies@digicol.de> > To: Zeev Suraski <zeev@php.net>, Andi Gutmans <andi@zend.com> > Cc: php4beta@lists.php.net > Subject: [PHP4BETA] zend_list_addref() / zend_list_delete() question. > > hi, > > been playing with the refcount stuff - works GREAT! > > question: > > can i call zend_list_delete() from a destructor function? - it would be > great if we could implement resource-dependicies that way! From glancing at the code, I think you can. Remember you can't rely on order of destruction though - if resource #2 depends on resource #1, on shutdown time, resource #1 may be deleted before resource #2, and by the time resource #2 is destroyed, it'll be relying on invalid data (of course, if you can link resource #2 to #1 and delete #2 when #1 is destroyed, things would work fine). > sample shows how we can make sure that the db-connection gets closed > *AFTER* all cursors! > > BTW: i think it would be nice to have a zend_list_delref(id) > function/macro. zend_list_delete() reduces reference count and deletes the resource is the refcount reaches zero. Isn't that what you would want zend_list_delref() to do? Zeev -- ----------------------------------------------------- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il

« previous php.version4 (#5072) next »