Subj : compare and swap operation To : comp.programming.threads From : Yang Zhang Date : Tue Oct 11 2005 05:35 am I am reading some lock-free shared data-structures currently and am planning to implement some of them. They are mostly built on the atomic CAS (compare and swap) operation. I am just wondering how can I use the hardware CAS instruction? I googled for some time, but it seems there is very little information on this. I am mainly using C++, pthread library and the GNU g++ compiler and how can I use the hardware CAS instruction on Intel/Linux, Sparc/Solaris, and MIPS/IRIX systems. Can someone provide some examples or point me to the right place? Thanks in advance. --Yang .