This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add mutexes for various libc calls
authorKarl Williamson <khw@cpan.org>
Fri, 23 Sep 2022 00:43:23 +0000 (18:43 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 29 Sep 2022 19:08:27 +0000 (13:08 -0600)
There are various system calls used by perl that need to be protected by
a mutex in some configurations.  This commit adds the ones not
previously added, for use in future commits.  Further details are
in the merge commit message for this series of commits.

perl.h

diff --git a/perl.h b/perl.h
index 191a8b0..0263fd2 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -7152,6 +7152,7 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
 #  define LC_NUMERIC_UNLOCK       NOOP
 #endif
 
+   /* These non-reentrant versions use global space */
 #  define MBLEN_LOCK_                gwLOCALE_LOCK
 #  define MBLEN_UNLOCK_              gwLOCALE_UNLOCK
 
@@ -7161,6 +7162,22 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
 #  define WCTOMB_LOCK_               gwLOCALE_LOCK
 #  define WCTOMB_UNLOCK_             gwLOCALE_UNLOCK
 
+   /* Whereas the reentrant versions don't (assuming they are called with a
+    * per-thread buffer; some have the capability of being called with a NULL
+    * parameter, which defeats the reentrancy) */
+#  define MBRLEN_LOCK_                  NOOP
+#  define MBRLEN_UNLOCK_                NOOP
+#  define MBRTOWC_LOCK_                 NOOP
+#  define MBRTOWC_UNLOCK_               NOOP
+#  define WCRTOMB_LOCK_                 NOOP
+#  define WCRTOMB_UNLOCK_               NOOP
+
+#  define LC_COLLATE_LOCK               SETLOCALE_LOCK
+#  define LC_COLLATE_UNLOCK             SETLOCALE_UNLOCK
+
+#  define STRFTIME_LOCK                 ENV_LOCK
+#  define STRFTIME_UNLOCK               ENV_UNLOCK
+
 #ifdef USE_LOCALE_NUMERIC
 
 /* These macros are for toggling between the underlying locale (UNDERLYING or