C++ how to replace mutex code with CAS ( compare and exchange ) ( lock-less programming ) 5/5 (2)

It is well known that if  mutex protected codes could potentially be replaced by atomic compare exchange,  thus we cab achieve lock-less programming. In practice, it may need several techniques to get it working. Let’s look at a subscription example: Normal mutex An subscriber  can subscribe some content from a publisher, in other word, a publisher • Read More »