implement AtomicCmpXchg