I need to have atomic variables in my program. Previously I was using std::atomic<int>, but the platform in which I’m working now does not have a g++ compiler that supports C++0x. I used volatile int and it seems to be working, as I haven’t experienced a race condition yet in the multicore system I’m testing it on.
My question is if volatile int is atomic like std::atomic<int>? Also, does it creates memory barriers (which I also require)?
I’ve seen you asking about GCC in some comments, here you go.
GCC’s Built-in functions for atomic memory access