diff options
author | Karl Williamson <khw@cpan.org> | 2016-04-06 21:46:28 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-04-09 13:59:24 -0600 |
commit | 929e12133425199fce3fe026156c10876ac0cbb8 (patch) | |
tree | 95286d2bc13b80afe4ed3872c14fd9c081235260 | |
parent | 68b940afc96546256736bc5d8185075ddc12b205 (diff) | |
download | perl-929e12133425199fce3fe026156c10876ac0cbb8.tar.gz |
Add locale mutex
This adds a new mutex for use in the next commit for use with locale
handling.
-rw-r--r-- | dosish.h | 6 | ||||
-rw-r--r-- | embedvar.h | 2 | ||||
-rw-r--r-- | makedef.pl | 1 | ||||
-rw-r--r-- | perl.c | 1 | ||||
-rw-r--r-- | perl.h | 6 | ||||
-rw-r--r-- | perlapi.h | 2 | ||||
-rw-r--r-- | perlvars.h | 2 | ||||
-rw-r--r-- | symbian/symbianish.h | 6 | ||||
-rw-r--r-- | unixish.h | 14 | ||||
-rw-r--r-- | vms/vmsish.h | 3 | ||||
-rw-r--r-- | win32/win32.c | 1 | ||||
-rw-r--r-- | win32/wince.c | 1 |
12 files changed, 33 insertions, 12 deletions
@@ -52,9 +52,9 @@ #endif /* DJGPP */ #ifndef PERL_SYS_TERM_BODY -# define PERL_SYS_TERM_BODY() \ - HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ - OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM +# define PERL_SYS_TERM_BODY() \ + HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ + OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; LOCALE_TERM; #endif #define dXSUB_SYS diff --git a/embedvar.h b/embedvar.h index c366d474ec..7e551be021 100644 --- a/embedvar.h +++ b/embedvar.h @@ -387,6 +387,8 @@ #define PL_Ghints_mutex (my_vars->Ghints_mutex) #define PL_keyword_plugin (my_vars->Gkeyword_plugin) #define PL_Gkeyword_plugin (my_vars->Gkeyword_plugin) +#define PL_locale_mutex (my_vars->Glocale_mutex) +#define PL_Glocale_mutex (my_vars->Glocale_mutex) #define PL_malloc_mutex (my_vars->Gmalloc_mutex) #define PL_Gmalloc_mutex (my_vars->Gmalloc_mutex) #define PL_mmap_page_size (my_vars->Gmmap_page_size) diff --git a/makedef.pl b/makedef.pl index 78ee0b17f5..104696c8f3 100644 --- a/makedef.pl +++ b/makedef.pl @@ -364,6 +364,7 @@ unless ($define{'USE_ITHREADS'}) { PL_regex_padav PL_dollarzero_mutex PL_hints_mutex + PL_locale_mutex PL_my_ctx_mutex PL_perlio_mutex PL_stashpad @@ -93,6 +93,7 @@ S_init_tls_and_interp(PerlInterpreter *my_perl) OP_REFCNT_INIT; OP_CHECK_MUTEX_INIT; HINTS_REFCNT_INIT; + LOCALE_INIT; MUTEX_INIT(&PL_dollarzero_mutex); MUTEX_INIT(&PL_my_ctx_mutex); # endif @@ -5954,6 +5954,10 @@ typedef struct am_table_short AMTS; #ifdef USE_LOCALE /* These locale things are all subject to change */ + +# define LOCALE_INIT MUTEX_INIT(&PL_locale_mutex) +# define LOCALE_TERM MUTEX_DESTROY(&PL_locale_mutex) + /* Returns TRUE if the plain locale pragma without a parameter is in effect */ # define IN_LOCALE_RUNTIME cBOOL(CopHINTS_get(PL_curcop) & HINT_LOCALE) @@ -6037,6 +6041,8 @@ typedef struct am_table_short AMTS; # endif /* PERL_CORE or PERL_IN_XSUB_RE */ #else /* No locale usage */ +# define LOCALE_INIT +# define LOCALE_TERM # define IN_LOCALE_RUNTIME 0 # define IN_SOME_LOCALE_FORM_RUNTIME 0 # define IN_LOCALE_COMPILETIME 0 @@ -123,6 +123,8 @@ END_EXTERN_C #define PL_hints_mutex (*Perl_Ghints_mutex_ptr(NULL)) #undef PL_keyword_plugin #define PL_keyword_plugin (*Perl_Gkeyword_plugin_ptr(NULL)) +#undef PL_locale_mutex +#define PL_locale_mutex (*Perl_Glocale_mutex_ptr(NULL)) #undef PL_malloc_mutex #define PL_malloc_mutex (*Perl_Gmalloc_mutex_ptr(NULL)) #undef PL_mmap_page_size diff --git a/perlvars.h b/perlvars.h index 86a369e9ba..5466294963 100644 --- a/perlvars.h +++ b/perlvars.h @@ -99,6 +99,8 @@ PERLVARI(G, mmap_page_size, IV, 0) #if defined(USE_ITHREADS) PERLVAR(G, hints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */ +PERLVAR(G, locale_mutex, perl_mutex) /* Mutex for setlocale() changing */ + #endif #ifdef DEBUGGING diff --git a/symbian/symbianish.h b/symbian/symbianish.h index da5332c27a..80c580b16a 100644 --- a/symbian/symbianish.h +++ b/symbian/symbianish.h @@ -120,8 +120,10 @@ #define Mkdir(path,mode) mkdir((path),(mode)) #ifndef PERL_SYS_TERM_BODY -#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; \ - PERLIO_TERM; MALLOC_TERM; CloseSTDLIB(); +#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; \ + PERLIO_TERM; MALLOC_TERM; CloseSTDLIB(); \ + PERL_LOCALE_TERM + #endif #define BIT_BUCKET "NUL:" @@ -138,9 +138,10 @@ int afstat(int fd, struct stat *statb); #if defined(__amigaos4__) # define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT; amigaos4_init_fork_array(); amigaos4_init_environ_sema(); -# define PERL_SYS_TERM_BODY() \ - HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ - OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; amigaos4_dispose_fork_array(); +# define PERL_SYS_TERM_BODY() \ + HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ + OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; LOCALE_TERM; \ + amigaos4_dispose_fork_array(); #endif #ifndef PERL_SYS_INIT_BODY @@ -149,9 +150,10 @@ int afstat(int fd, struct stat *statb); #endif #ifndef PERL_SYS_TERM_BODY -# define PERL_SYS_TERM_BODY() \ - HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ - OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; +# define PERL_SYS_TERM_BODY() \ + HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ + OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; \ + LOCALE_TERM; #endif diff --git a/vms/vmsish.h b/vms/vmsish.h index cf1c9a8552..1aea82944c 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -315,7 +315,8 @@ struct interp_intern { #define BIT_BUCKET "/dev/null" #define PERL_SYS_INIT_BODY(c,v) MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); PERLIO_INIT; MALLOC_INIT -#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM +#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; \ + PERLIO_TERM; MALLOC_TERM; LOCALE_TERM #define dXSUB_SYS #define HAS_KILL #define HAS_WAIT diff --git a/win32/win32.c b/win32/win32.c index 651b97b417..6ac73e2af0 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4529,6 +4529,7 @@ Perl_win32_term(void) OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; + LOCALE_TERM; #ifndef WIN32_NO_REGISTRY /* handles might be NULL, RegCloseKey then returns ERROR_INVALID_HANDLE but no point of checking and we can't die() at this point */ diff --git a/win32/wince.c b/win32/wince.c index bcc66c8c12..ce064810ed 100644 --- a/win32/wince.c +++ b/win32/wince.c @@ -2705,6 +2705,7 @@ Perl_win32_term(void) OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; + LOCALE_TERM; } void |