Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-07 16:10:22


Miro Jurisic wrote:
> The answer I got from Apple about your question says:
>
> 1. Yes, the documentation for the userland calls is missing
> specification about memory synchronization behavior in the current
> version of the developer tools
> 2. The documentation for the corresponding kernel calls is at
> <http://developer.apple.com/documentation/Darwin/Reference/KernellibkernFramework/OSAtomic/>
> and includes memory synchronization behavior
> 3. It is safe to assume that the userland call Foo has the same
> behavior as the kernel call OSFoo for the purpose of this discussion.
> (This API discrepancy will be addressed in the future.)

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.

I don't think that we will gain anything from using these primitives. We'll
still retain our current ppc versions for non-Apple OSes.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk