I am looking for a comparator operator that can be used to compare two atomic variable atomically under C++11. Here i do not want to swap values stored under these atomic objs so i am not interested in compare_and_swap functions.Please refer example below:
std::atomic<uint32_t> readIdx{0};std::atomic<uint32_t> writeIdx{0};while(writeIdx + 1 == readIdx) <<<<------------------{ std::this_thread::yield();}
All i want, to make code represented with arrow line to be atomic. Is it possible?If not, does writeIdx == readIdx
is an atomic operation?