Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23998 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30633 invoked by uid 1010); 8 Jun 2006 18:03:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30618 invoked from network); 8 Jun 2006 18:03:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2006 18:03:48 -0000 X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:38623] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 26/94-00946-18668844 for ; Thu, 08 Jun 2006 14:03:48 -0400 Received: (qmail 7560 invoked from network); 8 Jun 2006 18:03:10 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 8 Jun 2006 18:03:10 -0000 Message-ID: <7.0.1.0.2.20060608110050.0521bb48@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Thu, 08 Jun 2006 11:03:29 -0700 To: "Dmitry Stogov" ,, "Ilia Alshanetsky" Cc: "Steph" In-Reply-To: <000001c68af5$50876930$6e02a8c0@thinkpad> References: <000001c68af5$50876930$6e02a8c0@thinkpad> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PATCH] Automatic module globals management From: andi@zend.com (Andi Gutmans) I read the whole thread. I agree with Sara. While I understand where Steph is coming from, I still think this is a good change. It would allow us to use this method in the current tree right away, and for PECL authors who want to stay compatible with older versions they can use the old & ugly way of doing it until they feel comfortable in changing over. I also second Sara on the naming changes of the macros. They ones suggested by Dmitry didn't appeal to me either :) Andi At 05:15 AM 6/8/2006, Dmitry Stogov wrote: >Hi, > >The attached patch (for PHP_5_2) implements automatic management of module >globals. >The problem that module globals must be unregistered before extension >unloading, because "globls_dtor" function is unloaded together with >extension and cannot be called. > >To solve this problem extension writers now use the following pattern: > > PHP_MSHUTDOWN_FUNCTION(mod_name) > { >-#ifdef ZTS >- ts_free_id(mod_name_globals_id); >-#else >- mod_name_globals_dtor(&mod_name_globals TSRMLS_CC); >-#endif > >With my patch, extension writers should just extend module descriptor with >globals descriptor and ctor/dtor callbacks. > > PHP_RSHUTDOWN(mod_name), > PHP_MINFO(mod_name), > NO_VERSION_YET, >- STANDARD_MODULE_PROPERTIES >+ NULL, >+ ZEND_MG(mod_name), >+ ZEND_MGCTOR(mod_name), >+ ZEND_MGCTOR(mod_name), >+ STANDARD_MODULE_PROPERTIES_EX2 > }; > >Old extensions are source compatible and may work without modification. >The patch modifies only several extensions, but will modify others too. > >I like commit the patch into HEAD and PHP_5_2. >Any objections, additional ideas? > >Thanks. Dmitry. >