Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2b9ba1b947dd0f0741670247b62dadd0f5260deb
      
https://github.com/Perl/perl5/commit/2b9ba1b947dd0f0741670247b62dadd0f5260deb
  Author: Karl Williamson <[email protected]>
  Date:   2024-02-09 (Fri, 09 Feb 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Each toggle locale must have matching restore

The next commit will want this symmetry, which until now hasn't
mattered.


  Commit: 43675576d7be4038995e4ddfb4d2ea132a626ec8
      
https://github.com/Perl/perl5/commit/43675576d7be4038995e4ddfb4d2ea132a626ec8
  Author: Karl Williamson <[email protected]>
  Date:   2024-02-09 (Fri, 09 Feb 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use a critical section when locale is toggled

Sometimes the locale for a category has to be toggled to some other
locale, when the desired value is for a locale that isn't the current
one.

This doesn't present any problem when locales are thread-safe.  The
locale gets toggled back before any other work is done.

But when locales are not thread-safe and we have threads, another thread
can execute in the now-wrong locale.  Perl, for a few releases now,
tries to mitigate the issues with running locales under threads when
yhread-safe locales are not in use, for mitigations that are easy to do.
These very well may make things work for applications that don't change
locales very much; say only on startup.

But now perl itself changes locales briefly behind an application's
back.  It turns out it is easy to add a lock that will keep threads that
otherwise would work to continue to work.

That's what this commit does, by adding TOGGLE_LOCK and TOGGLE_UNLOCK
macros that are no-ops for all but the unsafe-threaded locale
implementation.

The unused parameter to the macros is for future use.


Compare: https://github.com/Perl/perl5/compare/48c6b5da1dc5...43675576d7be

Reply via email to