For the functions here:
#include <libkern/OSAtomic.h>
there are OSAtomic and OSAtomicBarrier versions.
However, the documentation does not show sample code for:
- When is it safe to use just OSAtomic, without the OSAtomicBarrier version
- When is it that OSAtomic would be unsafe, but OSAtomiBarrier would be safe.
Can anyone provide explainations + sample codes?
[Random ramblings of "your opinion" without actual code is useless. Readers: please down vote such answers; and vigrously upvote answers with actual code.]
[C/C++ code preferred; Assembly okay too.]