make use of std::atomic<X >::compare_exchange_weak