
In article <00f901c53bb6$5caf34c0$6501a8c0@pdimov2>, "Peter Dimov" <pdimov@mmltd.net> wrote:
The documentation at the link above does not seem to describe memory synchronization. It only says that the operations are performed atomically.
The OSAtomicAdd/Increment/Decrement implementation in OSAtomic.s does not contain any sync or isync barriers. We need a decrement that is at least a release when the new value is nonzero and an acquire when the new value is zero.
OSCompareAndSwap (or its alias hw_compare_and_store in hw_lock.s) seems to provide acquire semantics on success (it has a trailing isync). This is also not mentioned in the documentation above.
Thanks. I understand the question better now. I am going to get you and Alexander in touch with someone who can answer your questions better than that web page or I can. meeroh