Correct memory ordering for `compare_exchange` fail path?

Just because your thread can see the write to the atomic, does not mean that it can also see the write to the data behind the pointer. Happens-Before Relationship by Relaxed memory ordering in single and multiple threads - #5 by alice

2 Likes