This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't create unneeded mutexes
authorKarl Williamson <khw@cpan.org>
Fri, 9 Mar 2018 18:27:28 +0000 (11:27 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 12 Mar 2018 16:22:01 +0000 (10:22 -0600)
These mutexes are needed only for unsafe threaded-locale operations.

makedef.pl
perlvars.h

index 06c647f..626d990 100644 (file)
@@ -436,6 +436,11 @@ unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
                         );
 }
 
+if (${^SAFE_LOCALES}) {
+    ++$skip{PL_locale_mutex};
+    ++$skip{PL_lc_numeric_mutex};
+}
+
 unless ($define{'PERL_OP_PARENT'}) {
     ++$skip{$_} foreach qw(
                    Perl_op_parent
index be67a59..0f2e347 100644 (file)
@@ -99,9 +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
 PERLVAR(G, locale_mutex, perl_mutex)   /* Mutex for setlocale() changing */
 PERLVAR(G, lc_numeric_mutex, perl_mutex)   /* Mutex for switching LC_NUMERIC */
-
+#  endif
 #endif
 
 /* Proxy for HAS_POSIX_2008_LOCALE, since that is not defined in time for this */