On Wednesday, 14 June 2017 at 12:48:14 UTC, Russel Winder wrote:
On Wed, 2017-06-14 at 10:40 +0000, gzp via Digitalmars-d wrote:
[…]
cas
in all api I've seen on a failed swap, the current value is
retrieved
(in c/c++ there are intrinsic for them)
This appears to be in core.atomic.
There is a misunderstanding here. cas() is in core.atomic, but it
returns true/false rather than the read value. However, this is
just fine for virtually all algorithms. In fact, the respective
<atomic> functions in C++11 also return a boolean result.
exchange
no api for it and not implementable without spinning
(in c/c++ there are intrinsic for them)
atomicFence
No memory ordering is considered in the API
Even tough it falls back to the strongest/slowest one for the
current implementation it should be part of the API.
Appears to be in core.atomic.
Where exactly would that be? There is no unconditional swap/xchg
in core.atomic, and atomicFence() indeed only supports
sequentially consistent semantics.
— David