ref: a25a94e8f04e1d852c4ac2e8924f243e2fb70cbb dir: /cas.c/
#include "u.h" #include "libc.h" int cas(int *x, int old, int new) { return __atomic_compare_exchange_n(x, &old, new, 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); }