diff options
author | Karl Williamson <khw@cpan.org> | 2018-03-09 12:53:13 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-03-12 10:22:01 -0600 |
commit | 69c5e0dbc1d307bce522321a107ca1670ec89f2c (patch) | |
tree | b35d1255f5a3464b9a6efdaae219ec001a34dc31 /perlvars.h | |
parent | 6470dfd24226b0307246dd4530b5acd43c2ec134 (diff) | |
download | perl-69c5e0dbc1d307bce522321a107ca1670ec89f2c.tar.gz |
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!
Diffstat (limited to 'perlvars.h')
-rw-r--r-- | perlvars.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/perlvars.h b/perlvars.h index d3275835dc..ac97ebcd99 100644 --- a/perlvars.h +++ b/perlvars.h @@ -99,8 +99,10 @@ PERLVARI(G, mmap_page_size, IV, 0) #if defined(USE_ITHREADS) PERLVAR(G, hints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */ -#ifndef USE_THREAD_SAFE_LOCALE +# if ! defined(USE_THREAD_SAFE_LOCALE) || defined(TS_W32_BROKEN_LOCALECONV) PERLVAR(G, locale_mutex, perl_mutex) /* Mutex for setlocale() changing */ +# endif +# ifndef USE_THREAD_SAFE_LOCALE PERLVAR(G, lc_numeric_mutex, perl_mutex) /* Mutex for switching LC_NUMERIC */ # endif #endif |