ref: 215ef6c03d4d69a4455e9729c463d6d8bc145848 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); }