Use __sync_bool_compare_and_swap in x86 locks.h.