Skip to content

Commit

Permalink
perl.h: Move #defining SETLOCALE_LOCK
Browse files Browse the repository at this point in the history
This simplifies slightly, and will allow further simplification
  • Loading branch information
khwilliamson committed May 6, 2021
1 parent 34f442f commit 75e5670
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions perl.h
Expand Up @@ -6724,7 +6724,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_
# ifdef USE_LOCALE_NUMERIC
# define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \
LOCALE_LOCK_(cond_to_panic_if_already_locked)
Expand Down Expand Up @@ -6763,8 +6764,6 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
* threaded build. */
# define LOCALE_READ_LOCK NOOP
# define LOCALE_READ_UNLOCK NOOP
# define SETLOCALE_LOCK NOOP
# define SETLOCALE_UNLOCK NOOP
#else

/* Here, we will need critical sections in locale handling, because one or
Expand Down Expand Up @@ -6796,16 +6795,6 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
* modern platforms will have reentrant versions (which don't lock) for
* almost all of them, so khw thinks a single mutex should suffice. */

# if defined(USE_THREAD_SAFE_LOCALE)

/* There may be instance core where we this is invoked yet should do
* nothing. Rather than have #ifdef's around them, define it here */
# define SETLOCALE_LOCK NOOP
# define SETLOCALE_UNLOCK NOOP
# else
# define SETLOCALE_LOCK LOCALE_LOCK_(0)
# define SETLOCALE_UNLOCK LOCALE_UNLOCK_
# endif
#endif

#ifndef LOCALE_LOCK_
Expand Down Expand Up @@ -6850,6 +6839,12 @@ the plain locale pragma without a parameter (S<C<use locale>>) is in effect.
# define PORCELAIN_SETLOCALE_UNLOCK gwLOCALE_UNLOCK
#endif

/* This was defined above for the case where locales aren't thread safe. */
#ifndef SETLOCALE_LOCK
# define SETLOCALE_LOCK NOOP
# define SETLOCALE_UNLOCK NOOP
#endif

#ifndef LC_NUMERIC_LOCK
# define LC_NUMERIC_LOCK(cond) NOOP
# define LC_NUMERIC_UNLOCK NOOP
Expand Down

0 comments on commit 75e5670

Please sign in to comment.