Replace swap with CAS

compare_and_swap could potentially lead to a performance increase.