This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Work around Microsoft threaded locale bug for localeconv()
authorKarl Williamson <khw@cpan.org>
Fri, 9 Mar 2018 19:53:13 +0000 (12:53 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 12 Mar 2018 16:22:01 +0000 (10:22 -0600)
commit69c5e0dbc1d307bce522321a107ca1670ec89f2c
treeb35d1255f5a3464b9a6efdaae219ec001a34dc31
parent6470dfd24226b0307246dd4530b5acd43c2ec134
Work around Microsoft threaded locale bug for localeconv()

Prior to Visual Studio 2015, the localeconv() function only looks at the
global locale, not the per-thread one it should.  This works around this
by creating critical sections, switching to the global locale to call
localeconv(), then switching back.  For the most common usage, it avoids
the switch by parsing a string it generates that should contain the
desired substring.  This leaves the switch required for retrieving the
floating point grouping separator and the currency string, plus
POSIX::localeconv().  The first two could be avoided by extra code as
detailed in the pod for switch_to_global_locale(); patches welcome!
ext/I18N-Langinfo/Langinfo.pm
ext/POSIX/POSIX.xs
ext/POSIX/lib/POSIX.pod
locale.c
makedef.pl
perl.h
perlvars.h