Is core.internal.atomic.atomicFetchAdd implementation really lock free?

claptrap clap at trap.com
Sat Dec 3 13:07:55 UTC 2022


On Wednesday, 30 November 2022 at 09:25:57 UTC, Iain Buclaw wrote:
> On Wednesday, 30 November 2022 at 00:35:55 UTC, claptrap wrote:
>> On Wednesday, 30 November 2022 at 00:16:00 UTC, rikki 
>> cattermole wrote:
>>
> C++'s 
> [std::atomic](https://github.com/gcc-mirror/gcc/blob/a1b5cdf381d6b02f5048d886a8377d0042bda3af/libstdc%2B%2B-v3/config/cpu/generic/atomicity_mutex/atomicity.h#L46) has followed this precedent too of using a mutex *if all else fails*.
>
> Really, you'd have to be pretty explicit in forcing GDC 
> built-in atomics to be disabled at configure-time - there's an 
> atomic library [right there in GCC's 
> tree](https://github.com/gcc-mirror/gcc/tree/master/libatomic) 
> if a given target does not have native support.

I used to make this joke about my brother, if you ever needed to 
know how to do something you would ask him what to do... and then 
do the exact opposite.

I feel the same way about C++



More information about the Digitalmars-d mailing list