What is the best cross platform library to use for atomic compare and swap operations in c++?
…Or at least for amd64 on Linux and Windows?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the compiler compatibility you need.
If you are using GCC on both platforms, you can just use GCC’s atomic primitives, as they are tied to the hardware architecture, not the OS platform.
Otherwise, as PeterK suggested, look at Boost. There is a Boost.Atomic candidate library; I don’t know what its status on being incorporated is.