Fixing core.atomic

IGotD- nise at nise.com
Sun May 30 20:58:56 UTC 2021


On Sunday, 30 May 2021 at 20:41:29 UTC, rm wrote:
> I plan on making core.atomic more consistent and easier to use. 
> Please provide me with your feedback.
>
>
> https://github.com/rymrg/drm/blob/main/atomic.d
> https://github.com/rymrg/drm/blob/main/atomic_rationale.md

Definitely, the D atomic library is cumbersome to use. C++ 
std::atomic supports operator overloading for example.

atomicVar += 1;

will create an atomic add as atomicVar is of the atomic type. D 
doesn't have this and I think D should add atomic types like 
std::atomic<T>. I like this because then I can easily switch 
between atomic operations and normal operations by just changing 
the type and very few changes.


More information about the Digitalmars-d mailing list