Compare and exchange the library?

What is the best cross platform library to use for atomic comparison and swap operations in C ++?

... Or at least for amd64 on Linux and Windows?

+3
source share
4 answers

It depends on the compiler compatibility.

If you use GCC on both platforms, you can simply use the GCC 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 library ; I do not know what his status is when turned on.

+2
source
+1

An alternative to forcing is TBB (Threading Building Blocks). This is not a large lib scale, like boost, and focuses on concurrent programming.

+1
source
0
source

Source: https://habr.com/ru/post/1752711/


All Articles