lwlock: Remove ForEachLWLockHeldByMe
authorAndres Freund <andres@anarazel.de>
Thu, 15 Jan 2026 19:54:16 +0000 (14:54 -0500)
committerAndres Freund <andres@anarazel.de>
Thu, 15 Jan 2026 19:57:45 +0000 (14:57 -0500)
As of commit fcb9c977aa5, ForEachLWLockHeldByMe(), introduced in f4ece891fc2f,
is not used anymore, as content locks are now implemented in bufmgr.c.  It
doesn't seem that likely that a new user of the functionality will appear all
that soon, making removal of the function seem like the most sensible path. It
can easily be added back if necessary.

Discussion: https://postgr.es/m/lneuyxqxamqoayd2ntau3lqjblzdckw6tjgeu4574ezwh4tzlg%40noioxkquezdw

src/backend/storage/lmgr/lwlock.c
src/include/storage/lwlock.h

index 415794682a27848372cf32a1258ab1697053705b..2ee0339c52e09b65fd3a8235f243d185d169f464 100644 (file)
@@ -1955,21 +1955,6 @@ LWLockReleaseAll(void)
 }
 
 
-/*
- * ForEachLWLockHeldByMe - run a callback for each held lock
- *
- * This is meant as debug support only.
- */
-void
-ForEachLWLockHeldByMe(void (*callback) (LWLock *, LWLockMode, void *),
-                                         void *context)
-{
-       int                     i;
-
-       for (i = 0; i < num_held_lwlocks; i++)
-               callback(held_lwlocks[i].lock, held_lwlocks[i].mode, context);
-}
-
 /*
  * LWLockHeldByMe - test whether my process holds a lock in any mode
  *
index a98d302c6020184bd9ce551c5d3a2b8f519491a4..df589902adcc01309c50ff768b276a138f4786d4 100644 (file)
@@ -129,8 +129,6 @@ extern void LWLockReleaseClearVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64
 extern void LWLockReleaseAll(void);
 extern void LWLockDisown(LWLock *lock);
 extern void LWLockReleaseDisowned(LWLock *lock, LWLockMode mode);
-extern void ForEachLWLockHeldByMe(void (*callback) (LWLock *, LWLockMode, void *),
-                                                                 void *context);
 extern bool LWLockHeldByMe(LWLock *lock);
 extern bool LWLockAnyHeldByMe(LWLock *lock, int nlocks, size_t stride);
 extern bool LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode);