Atomic operations like CMPXCHG simply don't work across cores. Check out these threads, for example:I have written a work-stealing deque, also based on a circular array of fixed size, but well, it has to use locks...
1 of 1 people found this helpful
As Andreas said, there is no available operation like "compare and swap". You need to work with the atomic test and set registers, the global timestamp counter, and/or the atomic increment counter.
My concern is that when the shared value is read it will may be read from cache instead of shared memory space and I would have no means to ensure the most recent value is being read.
Notice that the default mode for the shared memory is non-cacheable.