According to cppreference, in C++20 there are wait, notify_one, notify_all in std::atomic<T>. Looks like they make std::atomic<T> usable as a futex.
I'm asking why does wait accept std::memory_order as a parameter. As I always need to check if waking from wait is not spurious, I'll specify the memory order in corresponding load:
std::atomic<bool> x;
while (x.load(std::memory_order_acquire) == false)
{
x.wait(false, std::memory_order_acquire);
}
Or should I specify std::memory_order_relaxed for wait? Are there scenarios with wait not followed by load?