I'm porting some code using C++11 <atomic> which provides std::atomic<T>, and has some useful methods.
core.atomic provides the primitives with which these can be created, but I think core.atomic should go one step further and provide the direct parallels to C++'s std::atomic to make porting code fast and painless.
The missing functions are:
exchange, fetch_***, compare_exchange_weak/strong
Comment #1 by z.p.gaal.devel — 2017-06-14T13:23:11Z
Also plese take a look at this forum post:
https://forum.dlang.org/thread/[email protected]
What is the state of fences and compiler optimization?
Is it guaranteed that, no instruction is moved increctly before/after a fence/atomic operation ?
Comment #2 by z.p.gaal.devel — 2017-06-14T13:29:29Z
@TurkeyMan updated dlang/druntime pull request #2745 "Renovate core.atomic, improve and simplify the constraints on functions" fixing this issue:
- Add missing features to the API.
Renovate core.atomic, improve and simplify the constraints on functions.
Most functions are slightly more efficient.
Concentrate more specific work into less surface area.
Fixes issues 20107, 20106, 20105, 18643, 15007, 8831
https://github.com/dlang/druntime/pull/2745
Comment #5 by dlang-bot — 2019-08-31T10:37:48Z
dlang/druntime pull request #2745 "Renovate core.atomic, improve and simplify the constraints on functions" was merged into master:
- 1b139035a32f6aeedcdb8d1589af45e9deb73f88 by Manu Evans:
Renovate core.atomic, improve and simplify the constraints on functions.
Most functions are slightly more efficient.
Concentrate more specific work into less surface area.
Fixes issues 20107, 18643, 15007, 8831
https://github.com/dlang/druntime/pull/2745