Rename SETLOCALE_LOCK to LOCALE_LOCK

This mutex isn't just about the setlocale function; it applies to all
locale related critical sections.

There are no uses of SETLOCALE_LOCK in CPAN
This commit is contained in:
Karl Williamson 2023-01-11 16:08:02 -07:00
parent a2d04a5251
commit e4b22cb7fc
2 changed files with 17 additions and 17 deletions

View File

@ -6827,7 +6827,7 @@ Perl_my_strerror(pTHX_ const int errnum, utf8ness_t * utf8ness)
}
else {
SETLOCALE_LOCK;
LOCALE_LOCK;
const char * orig_locale = toggle_locale_i(WHICH_LC_INDEX, "C");
@ -6835,7 +6835,7 @@ Perl_my_strerror(pTHX_ const int errnum, utf8ness_t * utf8ness)
restore_toggled_locale_i(WHICH_LC_INDEX, orig_locale);
SETLOCALE_UNLOCK;
LOCALE_UNLOCK;
*utf8ness = UTF8NESS_IMMATERIAL;
@ -6865,7 +6865,7 @@ Perl_my_strerror(pTHX_ const int errnum, utf8ness_t * utf8ness)
: "C";
/* XXX Can fail on z/OS */
SETLOCALE_LOCK;
LOCALE_LOCK;
const char* orig_CTYPE_locale = toggle_locale_c(LC_CTYPE, desired_locale);
const char* orig_MESSAGES_locale = toggle_locale_c(LC_MESSAGES,
@ -6875,7 +6875,7 @@ Perl_my_strerror(pTHX_ const int errnum, utf8ness_t * utf8ness)
restore_toggled_locale_c(LC_MESSAGES, orig_MESSAGES_locale);
restore_toggled_locale_c(LC_CTYPE, orig_CTYPE_locale);
SETLOCALE_UNLOCK;
LOCALE_UNLOCK;
*utf8ness = get_locale_string_utf8ness_i(errstr, LOCALE_UTF8NESS_UNKNOWN,
NULL, LC_MESSAGES_INDEX_);

26
perl.h
View File

@ -7146,8 +7146,8 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
/* By definition, a thread-unsafe locale means we need a critical
* section. */
# define SETLOCALE_LOCK LOCALE_LOCK_(0)
# define SETLOCALE_UNLOCK LOCALE_UNLOCK_
# define LOCALE_LOCK LOCALE_LOCK_(0)
# define LOCALE_UNLOCK LOCALE_UNLOCK_
# ifdef USE_LOCALE_NUMERIC
# define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \
LOCALE_LOCK_(cond_to_panic_if_already_locked)
@ -7233,23 +7233,23 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
* could change out from under us, we use an exclusive LOCALE lock to prevent
* that, and a read ENV lock to prevent other threads that have nothing to do
* with locales here from changing the environment. */
#ifdef SETLOCALE_LOCK
#ifdef LOCALE_LOCK
# define gwENVr_LOCALEr_LOCK \
STMT_START { SETLOCALE_LOCK; ENV_READ_LOCK; } STMT_END
STMT_START { LOCALE_LOCK; ENV_READ_LOCK; } STMT_END
# define gwENVr_LOCALEr_UNLOCK \
STMT_START { ENV_READ_UNLOCK; SETLOCALE_UNLOCK; } STMT_END
STMT_START { ENV_READ_UNLOCK; LOCALE_UNLOCK; } STMT_END
#else
# define gwENVr_LOCALEr_LOCK ENV_LOCK
# define gwENVr_LOCALEr_UNLOCK ENV_UNLOCK
#endif
/* Now that we have defined gwENVr_LOCALEr_LOCK, we can finish defining
* SETLOCALE_LOCK, which we kept undefined until here on a thread-safe system
* LOCALE_LOCK, which we kept undefined until here on a thread-safe system
* so that we could use that fact to calculate what gwENVr_LOCALEr_LOCK should
* be */
#ifndef SETLOCALE_LOCK
# define SETLOCALE_LOCK NOOP
# define SETLOCALE_UNLOCK NOOP
#ifndef LOCALE_LOCK
# define LOCALE_LOCK NOOP
# define LOCALE_UNLOCK NOOP
#endif
@ -7259,8 +7259,8 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
* exclusive lock. By defining it here with this name, we can, for the
* most part, hide this detail from the rest of the code */
/* Currently, the read lock is an exclusive lock */
#define LOCALE_READ_LOCK SETLOCALE_LOCK
#define LOCALE_READ_UNLOCK SETLOCALE_UNLOCK
#define LOCALE_READ_LOCK LOCALE_LOCK
#define LOCALE_READ_UNLOCK LOCALE_UNLOCK
#ifndef LC_NUMERIC_LOCK
@ -7288,8 +7288,8 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
# define WCRTOMB_LOCK_ NOOP
# define WCRTOMB_UNLOCK_ NOOP
# define LC_COLLATE_LOCK SETLOCALE_LOCK
# define LC_COLLATE_UNLOCK SETLOCALE_UNLOCK
# define LC_COLLATE_LOCK LOCALE_LOCK
# define LC_COLLATE_UNLOCK LOCALE_UNLOCK
# define STRFTIME_LOCK ENV_LOCK
# define STRFTIME_UNLOCK ENV_UNLOCK