Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85698 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18813 invoked from network); 2 Apr 2015 21:10:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2015 21:10:44 -0000 Authentication-Results: pb1.pair.com header.from=keyurgovande@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=keyurgovande@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.173 as permitted sender) X-PHP-List-Original-Sender: keyurgovande@gmail.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:34676] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/A9-56257-350BD155 for ; Thu, 02 Apr 2015 16:10:43 -0500 Received: by obbgh1 with SMTP id gh1so140611024obb.1 for ; Thu, 02 Apr 2015 14:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8Lc7XSHeBM/DtZJxFll3Fh/9bPyNTtog77wmgXEBzoE=; b=gPeACs1aU3EpT/ohyUzOuxmNRufXg3AMfGyuv3iUFGlIETP3jqh7f+u5wOwr0Yf6Bt UItfzY7YNeOz5MrFBIdfu5Cn1u9YOP196L9K8+myJoQcWj/SryrTkCK8e0gQ6sactjB0 w8e/ZM5k0Lgj/4TEK+LJA9FNta6vBJ4MVFoybHVARw7rBj6lGF4oXbtVCYKSoRHja6Ch l8JPnjeEwb7BV5L9X4JhzShs4YL3LR+EVXyAPdoBiwnblQF05w/icPhg+BnRkcw8u1iQ L+TwX4E+ksCDHc7pnEhBeVlfi0li8K43slhd0NmxjDS30q0UhxxKBl2+9itAgTKaGBvs bcwA== MIME-Version: 1.0 X-Received: by 10.60.134.237 with SMTP id pn13mr50107554oeb.59.1428009040321; Thu, 02 Apr 2015 14:10:40 -0700 (PDT) Received: by 10.182.22.51 with HTTP; Thu, 2 Apr 2015 14:10:40 -0700 (PDT) In-Reply-To: References: <551CEDF6.7090408@lerdorf.com> Date: Thu, 2 Apr 2015 17:10:40 -0400 Message-ID: To: Ryan Pallas Cc: Adam Harvey , Dan Ackroyd , Rasmus Lerdorf , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b471e3a95a4310512c443af Subject: Re: [PHP-DEV] Deprecate setlocale? From: keyurgovande@gmail.com (Keyur Govande) --047d7b471e3a95a4310512c443af Content-Type: text/plain; charset=UTF-8 On Thu, Apr 2, 2015 at 3:55 PM, Ryan Pallas wrote: > > > On Thu, Apr 2, 2015 at 1:50 PM, Adam Harvey wrote: > >> On 2 April 2015 at 12:24, Dan Ackroyd wrote: >> > On 2 April 2015 at 16:01, Keyur Govande wrote: >> >> >> >> >> >> To Rasmus's point, here's a PR for HHVM to provide a thread-safe >> setlocale >> >> implementation: https://github.com/facebook/hhvm/pull/4736/files >> >> >> >> It should be fairly easy to refactor the thread-safe-setlocale.(h/cpp) >> files >> >> for Zend. >> > >> > Ok, that' pretty awesome. So assumming that we incorporated that new >> > thread safe version of locale, how would we expose it? Most people who >> > are calling setlocale are unaware of it's side effects, and so should >> > be using the new safe version by default. >> > >> > Some people who are calling setlocale will actually be using the >> > cross-thread behaviour and so that still needs to work. >> > >> > setlocale is a variadic function, so it's not possible to hack in a >> > flag parameter. As much as I dislike ini settings, it seems like >> > adding one here would be sensible e.g. 'thread_safe_setlocale' >> > >> > * If it's enabled the setlocale function calls the new thread safe >> > functionality. >> > >> > * If it's disabled the setlocale function calls the current non-TS C >> > setlocale function. >> > >> > >> > Does anyone have a better suggestion on exposing a thread safe version? >> >> What about just adding another function: setlocale_global(), or >> similar? I don't want a new INI setting any more than you do. >> >> Adam >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > I like the idea of an INI actually, but I would make it default to the > current bahaviour and user education so those who need TS know to change it. > The thread-safe version sets the locale globally for each thread and any code executing in that thread will be impacted. So the semantics are similar to how setlocale(3) works in a process. The thread-safe code would be wrapped in #ifdefs and only take effect in a right context. > > Ryan > --047d7b471e3a95a4310512c443af--