On 14/06/2017 11:40 AM, gzp wrote:
After digging into it the source for me it seems as D is lacking a
"standardized" atomic library. It has some basic concepts, but far
behind the c++ standards.
I don't know if there are any RFC-s in this topic but it requires a lot
of work. Just to mention some by my first experience:
cas
in all api I've seen on a failed swap, the current value is retrieved
(in c/c++ there are intrinsic for them)
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.
If D wants be be a real system programming language (ex a replacement
for c++) please address these issues. I'm not an expert on the subject,
but D seems to be in a c++11 stage where compiler/memory barriers and
atomic had to be implemented differently for each platform and the
programmer could only hope that compiler won't f*ck up everything during
optimization.
I don't know if D compiler is aware of the fences and won't move out/in
instructions from guarded areas.
Thanks: gzp
Please create an issue here: issues.dlang.org for druntime atomic support.
Clearly the requirements that we have been working under are not up to
your expectations (or needs).