Is core.internal.atomic.atomicFetchAdd implementation really lock free?
H. S. Teoh
hsteoh at qfbox.info
Wed Nov 30 00:22:24 UTC 2022
On Wed, Nov 30, 2022 at 01:16:00PM +1300, rikki cattermole via Digitalmars-d wrote:
> On 30/11/2022 1:12 PM, H. S. Teoh wrote:
> > Hmm, that's weird that the docs would say that. I've always been
> > under the impression that core.atomic ops use locks to achieve
> > atomicity.
>
> No its correct.
>
> As long as the hardware supports atomic operations, it'll use those
> instructions. It does have a fallback to use a mutex if need be
> though, which might be where you got that idea from.
Ah, I see. Thanks!
T
--
It is not the employer who pays the wages. Employers only handle the money. It is the customer who pays the wages. -- Henry Ford
More information about the Digitalmars-d
mailing list