summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-11-19 13:59:56 -0700
committerKarl Williamson <khw@cpan.org>2018-11-19 14:53:11 -0700
commite1895adcbd5ea43def0c89e1b0bff0628af49687 (patch)
tree770b1bb39c5dd092e96a8a4a2b61c0273929f2af
parentbc55cddf915d70f806feda38506788f4c61a2574 (diff)
downloadperl-e1895adcbd5ea43def0c89e1b0bff0628af49687.tar.gz
Allow forcing use of POSIX 2008 locale fcns
These thread-safe functions are not normally used on unthreaded builds, retaining the use of the library functions that have long been used. But, it is now possible to tell Configure to use them on unthreaded builds.
-rw-r--r--makedef.pl12
-rw-r--r--perl.h9
-rw-r--r--pod/perldelta.pod5
-rw-r--r--pod/perllocale.pod5
4 files changed, 25 insertions, 6 deletions
diff --git a/makedef.pl b/makedef.pl
index 6b97ad0033..3c541d85d6 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -129,7 +129,7 @@ if ($define{USE_ITHREADS} && $ARGS{PLATFORM} ne 'win32' && $ARGS{PLATFORM} ne 'n
$define{USE_REENTRANT_API} = 1;
}
-if ( $define{USE_ITHREADS}
+if ( ($define{USE_ITHREADS} || $define{USE_THREAD_SAFE_LOCALE})
&& $define{HAS_SETLOCALE}
&& ! $define{NO_LOCALE}
&& ! $define{NO_POSIX_2008_LOCALE})
@@ -386,7 +386,6 @@ unless ($define{'USE_ITHREADS'}) {
++$skip{$_} foreach qw(
PL_keyword_plugin_mutex
PL_check_mutex
- PL_curlocales
PL_op_mutex
PL_regex_pad
PL_regex_padav
@@ -425,10 +424,17 @@ unless ($define{'USE_ITHREADS'}) {
Perl_stashpv_hvname_match
Perl_regdupe_internal
Perl_newPADOP
- PL_C_locale_obj
);
}
+unless ($define{USE_ITHREADS} || $define{USE_THREAD_SAFE_LOCALE})
+{
+ ++$skip{$_} foreach qw(
+ PL_C_locale_obj
+ PL_curlocales
+ );
+}
+
unless ( $define{'HAS_NEWLOCALE'}
&& $define{'HAS_FREELOCALE'}
&& $define{'HAS_USELOCALE'}
diff --git a/perl.h b/perl.h
index ffa0e038c4..e436e03899 100644
--- a/perl.h
+++ b/perl.h
@@ -775,11 +775,16 @@
# define HAS_POSIX_2008_LOCALE
# endif
-# if defined(USE_ITHREADS) \
+ /* If compiled with
+ * -DUSE_THREAD_SAFE_LOCALE, will do so even
+ * on unthreaded builds */
+# if (defined(USE_ITHREADS) || defined(USE_THREAD_SAFE_LOCALE)) \
&& ( defined(HAS_POSIX_2008_LOCALE) \
|| (defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400)) \
&& ! defined(NO_THREAD_SAFE_LOCALE)
-# define USE_THREAD_SAFE_LOCALE
+# ifndef USE_THREAD_SAFE_LOCALE
+# define USE_THREAD_SAFE_LOCALE
+# endif
# ifdef HAS_POSIX_2008_LOCALE
# define USE_POSIX_2008_LOCALE
# endif
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 7332175ff3..62dbd34db2 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -264,7 +264,10 @@ L</Platform Support> section, instead.
=item *
-XXX
+Normally the thread-safe functions used only on threaded builds.
+It is now possible to force their use on unthreaded builds on systems
+that have them available, by including the
+C<-Accflags='-DUSE_THREAD_SAFE_LOCALE'> option to F<Configure>.
=back
diff --git a/pod/perllocale.pod b/pod/perllocale.pod
index 207aea0916..63f8947f96 100644
--- a/pod/perllocale.pod
+++ b/pod/perllocale.pod
@@ -517,6 +517,11 @@ from using thread-safe locales.
C<${^SAFE_LOCALES}> will be 0 on systems that turn off the thread-safe
operations.
+Normally on unthreaded builds, the traditional C<setlocale()> is used
+and not the thread-safe locale functions. You can force the use of these
+on systems that have them by adding the
+C<-Accflags='-DUSE_THREAD_SAFE_LOCALE'> to F<Configure>.
+
The initial program is started up using the locale specified from the
environment, as currently, described in L</ENVIRONMENT>. All newly
created threads start with C<LC_ALL> set to C<"C">>. Each thread may