Skip to content

Bad test and set spinlock #6

Description

@MBkkt

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions