Fix fallback implementation for pg_atomic_test_set_flag().
authorNathan Bossart <[email protected]>
Wed, 15 Nov 2023 21:04:18 +0000 (15:04 -0600)
committerNathan Bossart <[email protected]>
Wed, 15 Nov 2023 21:04:18 +0000 (15:04 -0600)
The fallback implementation of pg_atomic_test_set_flag() that uses
atomic-exchange gives pg_atomic_exchange_u32_impl() an extra
argument.  This issue has been present since the introduction of
the atomics API in commit b64d92f1a5.

Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/20231114035439.GA1809032%40nathanxps13
Back-through: 12

src/include/port/atomics/generic.h

index cb5804adbf949501b33f76cff3ba796d12602b0c..95d99dd0be0a6fb3463e80ee28b00709f2066f4c 100644 (file)
@@ -83,7 +83,7 @@ pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
 static inline bool
 pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
 {
-       return pg_atomic_exchange_u32_impl(ptr, &value, 1) == 0;
+       return pg_atomic_exchange_u32_impl(ptr, 1) == 0;
 }
 
 #define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG