Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 693e746bdd041bf76aefa9c804d7b11f6805edda
      
https://github.com/Perl/perl5/commit/693e746bdd041bf76aefa9c804d7b11f6805edda
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M autodoc.pl

  Log Message:
  -----------
  autodoc: Generalize a bit

Make lists available to other sections than the config.h one


  Commit: 9bc40f299041770852786bd2e3d8214e9a022834
      
https://github.com/Perl/perl5/commit/9bc40f299041770852786bd2e3d8214e9a022834
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M MANIFEST
    M Makefile.SH
    A perl_lock_definitions.h
    M regen.pl
    M regen/embed.pl
    A regen/lock_definitions.pl
    M t/porting/regen.t
    M win32/GNUmakefile
    M win32/Makefile

  Log Message:
  -----------
  Add perl_lock_definitions.h

This file is intended to insulate C code from thread issues, when used
as directed.

This commit merely creates the file; it is not #included yet.


  Commit: ec652e5f2fc77676f02c9c8413af689cf32d964e
      
https://github.com/Perl/perl5/commit/ec652e5f2fc77676f02c9c8413af689cf32d964e
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.c
    M perl.h
    M pod/perlrun.pod
    M regen/embed.pl

  Log Message:
  -----------
  Add DEBUG_K

This is for debugging mutex locking/unlocking.  Convert some locale
debug statements that are really about locking to use this.

This is not compile in by default because of the overhead during
time-critical operations.  It requires -Accflags=-DPERL_DEBUG_MUTEXES
to be passed to Configure.  Its use is for very low level problems.

It is incompatible with being compiled to have mem log.  Putting that
logic in its definition simplifies some code a bit.


  Commit: 2377a06d643bd06611de6bb80a023b696545dc2b
      
https://github.com/Perl/perl5/commit/2377a06d643bd06611de6bb80a023b696545dc2b
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M thread.h

  Log Message:
  -----------
  Use DEBUG_K in thread.h


  Commit: 34f04a5cb5371dba386ba4bd88ba6b17b20e84f9
      
https://github.com/Perl/perl5/commit/34f04a5cb5371dba386ba4bd88ba6b17b20e84f9
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Change formal macro parameter name

This is in preparation for a future commit when it otherwise would be
confusing.  The terminology is also changed to exclusive lock, as that
is clearer.


  Commit: 6ffdbe06e1dfec410a86cfa228126ce6ba6fe200
      
https://github.com/Perl/perl5/commit/6ffdbe06e1dfec410a86cfa228126ce6ba6fe200
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Add assertion


  Commit: 98477ae1d104de39261ef18fdf3a14e156aa1dab
      
https://github.com/Perl/perl5/commit/98477ae1d104de39261ef18fdf3a14e156aa1dab
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Swap macro definition order

Make the unlock mate of its corresponding lock adjacent to it


  Commit: 1ed86fee4dd8ddc7e7b2c15b2070c3082a5811fe
      
https://github.com/Perl/perl5/commit/1ed86fee4dd8ddc7e7b2c15b2070c3082a5811fe
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Swap two lines

This sets xcounter unconditionally, but now after the lock.  It's a
small thing, but I think it is slightly clearer


  Commit: 243679cb91e6ba8c3e9257c51607c4f99cc3f850
      
https://github.com/Perl/perl5/commit/243679cb91e6ba8c3e9257c51607c4f99cc3f850
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M sv.c

  Log Message:
  -----------
  clone_using: Use correct interpreter for check

Code shouldn't be trying to clone another interpreter while having
mutexes locked.  The lines changed in this commit were checking the
newly minted interpreter for this condition rather than the onde doing
the cloning.

Spotted by Matthew Horsfall


  Commit: 3325b315686782e4bfef82ff84c2b32b87bdaf7a
      
https://github.com/Perl/perl5/commit/3325b315686782e4bfef82ff84c2b32b87bdaf7a
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M sv.c

  Log Message:
  -----------
  clone_using: Move mutex init to early

The setup for mutex locking needs to be quite early in the cloning
process, so that that locking can happen during the remainder of the
setup.  It has to come after the debugging setup so that the locking
code can contain debug statements.  It turns out that this so far hasn't
been a problem, but would be on Windows machines, which will start to
use this mechanism in the next commit


  Commit: c349f09144035789a1820b4dc89c17d94b8027e5
      
https://github.com/Perl/perl5/commit/c349f09144035789a1820b4dc89c17d94b8027e5
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  Use perl's mutex locks on Windows

Because Windows boxes already have reentrant mutex locking (general
semaphores), the native lock was used.  But we are about to add new
capabilities to our locks, and the Windows native ones will be
insufficient, so convert to use ours.

This removes temporarily the read-only lock, in favor of the exclusive
one.  This will be restored after the read-only locking mechanism is
upgraded.


  Commit: 675709ddba743e33295ad5a8ca4b54417318bffe
      
https://github.com/Perl/perl5/commit/675709ddba743e33295ad5a8ca4b54417318bffe
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Temporarily remove debugging statements

This makes it easier to understand the logic changes in the next commit


  Commit: 7e2a7298b19d091f468173074fc3e138331ffb49
      
https://github.com/Perl/perl5/commit/7e2a7298b19d091f468173074fc3e138331ffb49
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Cast __LINE__ and use proper format

This changes various warnings and errors to use the LINE_Tf format and
to cast __LINE__ to it.


  Commit: fd412b3cb9a2ed415087b788b8935a6209decb86
      
https://github.com/Perl/perl5/commit/fd412b3cb9a2ed415087b788b8935a6209decb86
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M embedvar.h
    M intrpvar.h
    M makedef.pl
    M perl.h
    M sv.c

  Log Message:
  -----------
  Prepare for reentrant read-locks

Perl has mutexes to prevent cooperating threads from colliding in
accessing shared resources.  This requires all threads to use these; a
rogue thread that doesn't follow the protocol can wreak havoc.  We can
make sure that the perl core fully cooperates, but an XS module could go
rogue.

A thread can declare that it accesses the resource only to query it, and
will not change it in any way.  Any number of threads can be accessing
the resource in this manner at the same time without fear of collisions.
We say that such threads have read-only access.

A thread can also declare that it will be changing the resource.  Only
one thread can safely be doing this at a time.  It has exclusive access.

Perl has macros to call to lock and unlock the resource for both types
of access.  While a thread has exclusive access, any other thread
wanting either type of access will hang until the first thread releases
it.  Conversely, if a thread wants exclusive access, it will hang until
all the threads that have read-only access release their locks.  Any
number of threads may have simultaneous read-only locks.

The macros allow a thread to lock a resource while already holding it.
They are called general semaphores or recursive locks.  Only when the
unlock that matches the first lock is executed does the resource get
released.  Locking the rest of the system out from a resource should be
done for the shortest time possible to prevent bottlenecks.  A recursive
lock could encourage the bad habit of locking it longer than the minimum
possible.  But these locks have been added to existing code.  It would
be a tremendous amount of effort to change that code, hence the
recursiveness.

Commit 262c141 added two unused macros for future use.  It turns out
this was somewhat premature, because the implementation was buggy
(except they're not called).

This new commit fixes that, and the next few commits will finally start
to use these macros.

The problem was the interaction with exclusive locking attempts.  If a
thread owns an exclusive lock, and then recursively asks for a read one,
that should trivially succeed.  But instead it would hang, depending on
the system's locking implementation.  The solution is to add a
per-thread bookkeeping counter ourselves, so we bypass the system's in
this situation.

Conversely, an attempt to add an exclusive lock when already holding a
read lock was't handled properly.  I discovered via testing that this
can lead to deadlock (the comments added in this commit explain the
scenario).  This commit hence panics when such an attempt is made.  The
panic is to try to make sure that code that can trigger this doesn't get
shipped.


  Commit: 7956cb53fe598eb55286db91feb09ca4ca0d7c30
      
https://github.com/Perl/perl5/commit/7956cb53fe598eb55286db91feb09ca4ca0d7c30
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Add DEBUG_K to locking macros


  Commit: 37f542bee422670174a54f47361c088989e64b8d
      
https://github.com/Perl/perl5/commit/37f542bee422670174a54f47361c088989e64b8d
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  Use reentrant lock for ENV read lock

Now that we have a general reentrant read-only lock, restore using it.
This prepares for future commits


  Commit: 8e8cb5d83fe408c57d495607d464029310be9290
      
https://github.com/Perl/perl5/commit/8e8cb5d83fe408c57d495607d464029310be9290
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M intrpvar.h
    M locale.c
    M perl.h
    M sv.c

  Log Message:
  -----------
  Create locale mutex even without locales

A future commit will use this mutex for other purposes, even if locales
are not enabled.  Instead, create it whenever threads exist.


  Commit: 28fb53b5154985fe8b1c502a64e47d7f8dc73424
      
https://github.com/Perl/perl5/commit/28fb53b5154985fe8b1c502a64e47d7f8dc73424
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Create an actual LOCALE_READ_LOCK

A lock by this name has existed for a few releases, but it actually was
an exclusive lock.  Previous commits have added the infrastructure to do
an actual read-only lock.  Take advantage of it.


  Commit: 94ab91fb3e39fb77279077357575c8b57e167a29
      
https://github.com/Perl/perl5/commit/94ab91fb3e39fb77279077357575c8b57e167a29
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Create expansions for lock_definitions.h

That header file maps libc calls that need mutex locking into
various macros, based on the characteristics of each libc call.  But it
leaves it to perl.h to define those various expansions.  This commit
does that, based on the Configuration of the build.


  Commit: f0fc41f2396ab13b521b11c68692759d2af6b869
      
https://github.com/Perl/perl5/commit/f0fc41f2396ab13b521b11c68692759d2af6b869
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Rework WSETLOCALE_LOCK,POSIX_SETLOCALE_LOCK

This is clearer code.


  Commit: e20b213b30098a6945b1d218b0c7ec012f9e0dcd
      
https://github.com/Perl/perl5/commit/e20b213b30098a6945b1d218b0c7ec012f9e0dcd
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h
    M perl_lock_definitions.h
    M regen/lock_definitions.pl

  Log Message:
  -----------
  lock_definitions.h: Add backward-compatibility spellings

The many macros in this file now all begin with "PERL_" to avoid
namespace pollution.  However, a few names already existed in previous
Perl releases without that prefix.  This commit allows those names to be
retained, along with the new spellings.


  Commit: 2677df39a4ba78031dfe13ebd824b6e9986142b4
      
https://github.com/Perl/perl5/commit/2677df39a4ba78031dfe13ebd824b6e9986142b4
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h
    M pod/perldelta.pod

  Log Message:
  -----------
  Remove two ineffective mutex locks

This commit could break something that relies on these, but it would be
broken anyway because these locks are ineffective.  The reason is that
these functions need to be used in conjunction with other functions in a
critical section, and the locks are not designed for that.  Using them
could give a false sense of security.


  Commit: d65cc106b2f8f96f16cba1b02c72ee24bb0fe8ef
      
https://github.com/Perl/perl5/commit/d65cc106b2f8f96f16cba1b02c72ee24bb0fe8ef
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Rework backward compatibility locks

The mutex lock macros in this commit are retained for backwards
compatibility, but are now formulated in terms of their new names


  Commit: e9c3b5be4d4326352d11be18b40e75fddca1a800
      
https://github.com/Perl/perl5/commit/e9c3b5be4d4326352d11be18b40e75fddca1a800
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Sort some #defines

This makes it more convenient for a reader to find a line


  Commit: e7ca269055a764662de37203a8b9d809cde25da5
      
https://github.com/Perl/perl5/commit/e7ca269055a764662de37203a8b9d809cde25da5
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Rearrange some initialization code

This code had gotten fragmented.  Put as much stuff controlled by the
same #ifdef logic under a single #ifdef


  Commit: 3c2970ae1f4bfb20316bf6e849d1a66e23d3e6ac
      
https://github.com/Perl/perl5/commit/3c2970ae1f4bfb20316bf6e849d1a66e23d3e6ac
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Enable shortened critical section times

Since 5335601b6b6a88f5244d09fd2c1e531a1918ec12, there has been the
capability of having nested locks, where the inner one is necessary in
all conditions, and the outer one is desirable in just some conditions.

But this hasn't been enabled because in some Configurations it could
cause a deadlock, with the thread locking the ENV mutex, and then in a
nested call trying to lock it again.  A previous commit made this mutex
reentrant, so the deadlock is gone.


  Commit: 6aea62045db546100562f0f9fdecea3034010b83
      
https://github.com/Perl/perl5/commit/6aea62045db546100562f0f9fdecea3034010b83
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Update to use new names for lock macros

Some of these actually change the lock to a new name, specifically for
the function being protected.


  Commit: ff6a455c2b4a31a7a88c937a4f10fa0500d69a90
      
https://github.com/Perl/perl5/commit/ff6a455c2b4a31a7a88c937a4f10fa0500d69a90
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add some missing mutex locks

These wrap various function calls with mutex macros designed for the
purpose.  I have gone through the code to check that these don't occur
while already locked.  One is commented out where that would have been
the case.  A custom lock is used for the other.

Otherwise, there is no obvious instances of this, but now that we have
general semaphores, such cases would be seamlessly handled.


  Commit: 8e73dee4e7baf8da05848d2598b8823f95b4a3cc
      
https://github.com/Perl/perl5/commit/8e73dee4e7baf8da05848d2598b8823f95b4a3cc
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rework LOCALECONV_LOCK

The generated one in locale_definitions.h is suitable for our purposes.


  Commit: 6ef2cc4e861c134f36412692aea617f08b702b96
      
https://github.com/Perl/perl5/commit/6ef2cc4e861c134f36412692aea617f08b702b96
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use PERL_QUERYLOCALE_LOCK

The logic for creating this lock is now in lock_definitions.h.  Use it,
removing the now duplicate logic here.


  Commit: f2f4cf1d6cb3dbbecb4f65b705d45e1c1cbcf895
      
https://github.com/Perl/perl5/commit/f2f4cf1d6cb3dbbecb4f65b705d45e1c1cbcf895
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M autodoc.pl

  Log Message:
  -----------
  perlapi: Add list of libc functions with mutex locks

This adds a section listing the libc functions for which Perl creates
macros to wrap with to assure thread-safety


  Commit: d38181da23d6218d93d454ebe48d6aba1788e193
      
https://github.com/Perl/perl5/commit/d38181da23d6218d93d454ebe48d6aba1788e193
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M pod/perlclib.pod

  Log Message:
  -----------
  perlclib: Update to discuss new mutex lock macros


  Commit: 51272e2526d9952e691b0fa3c7ff83241f28959b
      
https://github.com/Perl/perl5/commit/51272e2526d9952e691b0fa3c7ff83241f28959b
  Author: Karl Williamson <[email protected]>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/perlxs.pod
    M reentr.h
    M regen/reentr.pl

  Log Message:
  -----------
  perlxs: Update to discuss new mutex lock macros


Compare: https://github.com/Perl/perl5/compare/975358ef61ae...51272e2526d9

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to