I am trying to port some code that I wrote from Mac OS X to Linux, and I am struggling to find a suitable replacement only for OSX OSAtomic.h. I found the gcc family __sync*, but I'm not sure if it will be compatible with the old compiler / kernel that I have. I need code to run in GCC v4.1.2 and kernel 2.6.18.
I need specific operations:
- Increment
- Decrease
- Comparison and Swap
Which is strange: running locate stdatomic.hon a linux machine finds the header file (in the C ++ directory), while executing the same command on my OSX machine (gcc v4.6.3) returns nothing. What do I need to install in order to get the stdatomic library, and will it work with gcc v 4.1.2?
As a side note, I cannot use third-party libraries.
source
share