I know that on MacOSX / PosiX systems, there is atomic-compare-and-swap for C/C++ code via g++.
However, I don't need the compare -- I just want to atomically swap two values. Is there an atomic swap operation available? [Everythign I can find is atomic_compare_and_swap ... and I just want to do the swap, without comparing].
Thanks!
...
Is OSCompareAndSwap (Mac OS X) equivalent to CMPXCHG8B?
...
I want to verify that my understanding is correct. This kind of thing is tricky so I'm almost sure I am missing something. I have a program consisting of a real-time thread and a non-real-time thread. I want the non-RT thread to be able to swap a pointer to memory that is used by the RT thread.
From the docs, my understanding is that...
I have a large data structure that is using striping to reduce lock contention. Right now I am using system locks but 99.99% of the time, the lock is uncontested and futhermore, the amount of time holding the lock is quite miniscule. However, several distinct memory operations are performed while the lock is held. It has actually gott...