@@ -113,6 +113,13 @@
} while(0)
#endif
+/*
+ * We might we tempted to use __atomic_test_and_set with __ATOMIC_ACQUIRE;
+ * however, the documentation explicitly says that we should only pass
+ * a boolean to it, so we use __sync_lock_test_and_set, which doesn't
+ * have this limitation, and is documented to have acquire semantics.
+ */
+#define atomic_test_and_set_acquire(ptr) __sync_lock_test_and_set(ptr, true)
/* All the remaining operations are fully sequentially consistent */
@@ -327,6 +334,8 @@
#endif
#endif
+#define atomic_test_and_set_acquire(ptr) __sync_lock_test_and_set(ptr, true)
+
/* Provide shorter names for GCC atomic builtins. */
#define atomic_fetch_inc(ptr) __sync_fetch_and_add(ptr, 1)
#define atomic_fetch_dec(ptr) __sync_fetch_and_add(ptr, -1)