Skip to content

Commit

Permalink
Add mutex for dealing with qr/\p{user-defined}/
Browse files Browse the repository at this point in the history
This will be used in future commits
  • Loading branch information
khwilliamson committed Feb 15, 2019
1 parent 3c5142a commit 8310e7f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dosish.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions embedvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@
#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)
Expand Down
1 change: 1 addition & 0 deletions makedef.pl
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ sub readvar {

unless ($define{'USE_ITHREADS'}) {
++$skip{PL_thr_key};
++$skip{PL_user_prop_mutex};
}

# USE_5005THREADS symbols. Kept as reference for easier removal
Expand Down
1 change: 1 addition & 0 deletions perl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions perlapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions perlvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
4 changes: 2 additions & 2 deletions unixish.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 8310e7f

Please sign in to comment.