Hi,
On 2024-07-31 17:52:34 +1200, Thomas Munro wrote:
> 2. The pg_atomic_unlocked_test_flag() function was surprising to me:
> it returns true if it's not currently set (according to a relaxed
> load). Most of this patch was easy, but figuring out that I had
> reverse polarity here was a multi-coffee operation :-) I can't call
> it wrong though, as it's not based on <stdatomic.h>, and it's clearly
> documented, so *shrug*.
I have no idea why I did it that way round. This was a long time ago...
> 4. Another reason would be that you need it to implement
> SpinLockFree() and S_LOCK_FREE(). They don't seem to have had any
> real callers since the beginning of open source PostgreSQL!, except
> for a test of limited value in a new world without ports developing
> their own spinlock code. Let's remove them! I see this was already
> threatened by Andres in 3b37a6de.
Note that I would like to add a user for S_LOCK_FREE(), to detect repeated
SpinLockRelease():
https://postgr.es/m/20240729182952.hua325647e2ggbsy%40awork3.anarazel.de
Greetings,
Andres Freund