Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26738 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37394 invoked by uid 1010); 29 Nov 2006 22:16:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37379 invoked from network); 29 Nov 2006 22:16:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2006 22:16:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:17802] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/C2-17687-9A60E654 for ; Wed, 29 Nov 2006 17:16:46 -0500 Received: (qmail 2606 invoked from network); 29 Nov 2006 22:14:40 -0000 Received: from office.zend.office (HELO ?127.0.0.1?) (192.168.16.109) by internal.zend.office with SMTP; 29 Nov 2006 22:14:40 -0000 Message-ID: <456E06A2.60007@zend.com> Date: Wed, 29 Nov 2006 14:16:02 -0800 Organization: Zend Technologies User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: Andy Wharmby CC: PHP internals list References: <456D8D30.7070405@googlemail.com> In-Reply-To: <456D8D30.7070405@googlemail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Question on thread safety From: stas@zend.com (Stanislav Malyshev) > So finally to my question. Is it the intention of TSRMc. to allow > ts_allocate_id() to be called at any time or is there an unwritten rule > that it > should only ever called during php startup ? If its the former then I I think it gets called only on startup. I also think it was the intent, though there is no safeguard as far as I can see against calling it in run-time, but no module does it and it doesn't make sense to do it in other place than startup. > I myself see no reason why extension writers should be restricted from > calling ts_allocate_id() outside PHP startup so believe the code needs Well, the reason is that if you want to use TSRM globals, you have to allocate ID before you do basically anything with them. Startup is a good place for that. If you don't need globals, then you should not call it at all. The situation where in the mid-run you suddenly remember you need globals seems quite unrealistic to me. Of course, if you can describe scenario when you would really need it in mid-run or it would make sense to allocate ID in mid-run, then I guess this should be fixed or at least safeguarded. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/