https://github.com/disba1ancer/dse/blob/master/src/util/spinlock.h#L19
It works slowly.
You need at least something like this in lock:
while (flag.exchange(true, std::memory_order_acquire)) {
do {
// some spin: 20 ~ 100 iteration with asm pause, then std::this_thread::yield()
} while (flag.load(std::memory_order_relaxed));
}
This algorithm is loyal to the cache coherency protocols.
And use alignas(64/128)
https://github.com/disba1ancer/dse/blob/master/src/util/spinlock.h#L19
It works slowly.
You need at least something like this in lock:
This algorithm is loyal to the cache coherency protocols.
And use alignas(64/128)