6 class __attribute__((aligned(64)))
SpinLock {
8 std::atomic_flag latch = ATOMIC_FLAG_INIT;
13 bool trylock() {
return !latch.test_and_set(std::memory_order::memory_order_acquire); }
21 void unlock() { latch.clear(std::memory_order::memory_order_release); }
27 std::atomic_flag latch = ATOMIC_FLAG_INIT;
31 volatile char c[64 -
sizeof(std::atomic_flag)];
39 bool trylock() {
return !latch.test_and_set(std::memory_order::memory_order_acquire); }
47 void unlock() { latch.clear(std::memory_order::memory_order_release); }