On 2 April 2015 at 12:24, Dan Ackroyd <dan...@basereality.com> wrote: > On 2 April 2015 at 16:01, Keyur Govande <keyurgova...@gmail.com> 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