Remove SpinLockFree() and S_LOCK_FREE().

S_LOCK_FREE() is used by the test program in s_lock.c, but nobody
has voiced concerns about losing some coverage there.
SpinLockFree() appears to have been unused since it was introduced
by commit 499abb0c0f.  There was agreement to remove these in 2020,
but it never happened.  Since we still have agreement for removal
in 2026, let's do that now.

Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/aZX2oUcKf7IzHnnK%40nathan
Discussion: https://postgr.es/m/20200608225338.m5zho424w6lpwb2d%40alap3.anarazel.de
This commit is contained in:
Nathan Bossart
2026-02-19 16:19:41 -06:00
parent aa71a35a40
commit ba401828c1
3 changed files with 0 additions and 38 deletions

View File

@ -262,12 +262,6 @@ main()
return 1;
}
if (!S_LOCK_FREE(&test_lock.lock))
{
printf("S_LOCK_TEST: failed, lock not initialized\n");
return 1;
}
S_LOCK(&test_lock.lock);
if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
@ -276,12 +270,6 @@ main()
return 1;
}
if (S_LOCK_FREE(&test_lock.lock))
{
printf("S_LOCK_TEST: failed, lock not locked\n");
return 1;
}
S_UNLOCK(&test_lock.lock);
if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
@ -290,12 +278,6 @@ main()
return 1;
}
if (!S_LOCK_FREE(&test_lock.lock))
{
printf("S_LOCK_TEST: failed, lock not unlocked\n");
return 1;
}
S_LOCK(&test_lock.lock);
if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
@ -304,12 +286,6 @@ main()
return 1;
}
if (S_LOCK_FREE(&test_lock.lock))
{
printf("S_LOCK_TEST: failed, lock not re-locked\n");
return 1;
}
printf("S_LOCK_TEST: this will print %d stars and then\n", NUM_DELAYS);
printf(" exit with a 'stuck spinlock' message\n");
printf(" if S_LOCK() and TAS() are working.\n");

View File

@ -21,10 +21,6 @@
* void S_UNLOCK(slock_t *lock)
* Unlock a previously acquired lock.
*
* bool S_LOCK_FREE(slock_t *lock)
* Tests if the lock is free. Returns true if free, false if locked.
* This does *not* change the state of the lock.
*
* void SPIN_DELAY(void)
* Delay operation to occur inside spinlock wait loop.
*
@ -671,10 +667,6 @@ spin_delay(void)
(TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0)
#endif /* S_LOCK */
#if !defined(S_LOCK_FREE)
#define S_LOCK_FREE(lock) (*(lock) == 0)
#endif /* S_LOCK_FREE */
#if !defined(S_UNLOCK)
/*
* Our default implementation of S_UNLOCK is essentially *(lock) = 0. This

View File

@ -18,10 +18,6 @@
* void SpinLockRelease(volatile slock_t *lock)
* Unlock a previously acquired lock.
*
* bool SpinLockFree(slock_t *lock)
* Tests if the lock is free. Returns true if free, false if locked.
* This does *not* change the state of the lock.
*
* Callers must beware that the macro argument may be evaluated multiple
* times!
*
@ -60,6 +56,4 @@
#define SpinLockRelease(lock) S_UNLOCK(lock)
#define SpinLockFree(lock) S_LOCK_FREE(lock)
#endif /* SPIN_H */