Add mutex for dealing with qr/\p{user-defined}/
authorKarl Williamson <khw@cpan.org>
Wed, 15 Aug 2018 21:45:14 +0000 (15:45 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 15 Feb 2019 05:12:44 +0000 (22:12 -0700)
This will be used in future commits

dosish.h
embedvar.h
makedef.pl
perl.c
perl.h
perlapi.h
perlvars.h
unixish.h

index 16ee9b7..dff759b 100644 (file)
--- a/dosish.h
+++ b/dosish.h
@@ -51,7 +51,7 @@
 #  define PERL_SYS_TERM_BODY()                         \
     HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM;      \
     OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; PERLIO_TERM;  \
-    MALLOC_TERM; LOCALE_TERM;
+    MALLOC_TERM; LOCALE_TERM; USER_PROP_MUTEX_TERM;
 #endif
 #define dXSUB_SYS dNOOP
 
index 787d046..79f5bd0 100644 (file)
 #define PL_Gtimesbase          (my_vars->Gtimesbase)
 #define PL_use_safe_putenv     (my_vars->Guse_safe_putenv)
 #define PL_Guse_safe_putenv    (my_vars->Guse_safe_putenv)
+#define PL_user_prop_mutex     (my_vars->Guser_prop_mutex)
+#define PL_Guser_prop_mutex    (my_vars->Guser_prop_mutex)
 #define PL_utf8_charname_begin (my_vars->Gutf8_charname_begin)
 #define PL_Gutf8_charname_begin        (my_vars->Gutf8_charname_begin)
 #define PL_utf8_charname_continue      (my_vars->Gutf8_charname_continue)
index e5ee6b9..7e22e02 100644 (file)
@@ -352,6 +352,7 @@ if ($define{'PERL_USE_SAFE_PUTENV'}) {
 
 unless ($define{'USE_ITHREADS'}) {
     ++$skip{PL_thr_key};
+    ++$skip{PL_user_prop_mutex};
 }
 
 # USE_5005THREADS symbols. Kept as reference for easier removal
diff --git a/perl.c b/perl.c
index d82e1e7..3c49f96 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -95,6 +95,7 @@ S_init_tls_and_interp(PerlInterpreter *my_perl)
         KEYWORD_PLUGIN_MUTEX_INIT;
        HINTS_REFCNT_INIT;
         LOCALE_INIT;
+        USER_PROP_MUTEX_INIT;
        MUTEX_INIT(&PL_dollarzero_mutex);
        MUTEX_INIT(&PL_my_ctx_mutex);
 #  endif
diff --git a/perl.h b/perl.h
index dd66b12..757fc70 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -5991,11 +5991,19 @@ typedef struct am_table_short AMTS;
 #  define KEYWORD_PLUGIN_MUTEX_LOCK    MUTEX_LOCK(&PL_keyword_plugin_mutex)
 #  define KEYWORD_PLUGIN_MUTEX_UNLOCK  MUTEX_UNLOCK(&PL_keyword_plugin_mutex)
 #  define KEYWORD_PLUGIN_MUTEX_TERM    MUTEX_DESTROY(&PL_keyword_plugin_mutex)
+#  define USER_PROP_MUTEX_INIT    MUTEX_INIT(&PL_user_prop_mutex)
+#  define USER_PROP_MUTEX_LOCK    MUTEX_LOCK(&PL_user_prop_mutex)
+#  define USER_PROP_MUTEX_UNLOCK  MUTEX_UNLOCK(&PL_user_prop_mutex)
+#  define USER_PROP_MUTEX_TERM    MUTEX_DESTROY(&PL_user_prop_mutex)
 #else
 #  define KEYWORD_PLUGIN_MUTEX_INIT    NOOP
 #  define KEYWORD_PLUGIN_MUTEX_LOCK    NOOP
 #  define KEYWORD_PLUGIN_MUTEX_UNLOCK  NOOP
 #  define KEYWORD_PLUGIN_MUTEX_TERM    NOOP
+#  define USER_PROP_MUTEX_INIT    NOOP
+#  define USER_PROP_MUTEX_LOCK    NOOP
+#  define USER_PROP_MUTEX_UNLOCK  NOOP
+#  define USER_PROP_MUTEX_TERM    NOOP
 #endif
 
 #ifdef USE_LOCALE /* These locale things are all subject to change */
index de4267a..6d8ebf8 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -215,6 +215,8 @@ END_EXTERN_C
 #define PL_timesbase           (*Perl_Gtimesbase_ptr(NULL))
 #undef  PL_use_safe_putenv
 #define PL_use_safe_putenv     (*Perl_Guse_safe_putenv_ptr(NULL))
+#undef  PL_user_prop_mutex
+#define PL_user_prop_mutex     (*Perl_Guser_prop_mutex_ptr(NULL))
 #undef  PL_utf8_charname_begin
 #define PL_utf8_charname_begin (*Perl_Gutf8_charname_begin_ptr(NULL))
 #undef  PL_utf8_charname_continue
index 8a4ff6a..331105e 100644 (file)
@@ -307,6 +307,10 @@ PERLVAR(G, utf8_mark,      SV *)
 PERLVAR(G, InBitmap,   SV *)
 PERLVAR(G, CCC_non0_non230,    SV *)
 
+#if defined(USE_ITHREADS)
+PERLVAR(G, user_prop_mutex, perl_mutex)
+#endif
+
 /* Everything that folds to a given character, for case insensitivity regex
  * matching */
 PERLVAR(G, utf8_foldclosures, SV *)
index cd869cd..697a242 100644 (file)
--- a/unixish.h
+++ b/unixish.h
@@ -141,7 +141,7 @@ int afstat(int fd, struct stat *statb);
 #  define PERL_SYS_TERM_BODY()                         \
     HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM;      \
     OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; PERLIO_TERM;  \
-    MALLOC_TERM; LOCALE_TERM;                          \
+    MALLOC_TERM; LOCALE_TERM; USER_PROP_MUTEX_TERM;    \
     amigaos4_dispose_fork_array();
 #endif
 
@@ -154,7 +154,7 @@ int afstat(int fd, struct stat *statb);
 #  define PERL_SYS_TERM_BODY()                         \
     HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM;      \
     OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; PERLIO_TERM;  \
-    MALLOC_TERM; LOCALE_TERM;
+    MALLOC_TERM; LOCALE_TERM; USER_PROP_MUTEX_TERM;
 
 #endif