LDC optimized builds causing unexpected behaviour when sharing variable between threads
Keivan Shah
keivan.shah at silverleafcaps.com
Thu Jun 2 17:41:48 UTC 2022
On Thursday, 2 June 2022 at 11:56:07 UTC, Johan wrote:
> `atomicFence` only works for ordering memory operations on a
> single thread, not ordering between threads.
>
> You can either use a mutex (to coordinate between threads), or
> need all store/loads to be atomic with `atomic{Store,Load}`.
> I am surprised that there is no `core.atomic!int` to simplify
> your life. Perhaps you should make a feature request :)
>
> -Johan
Hey Johan,
Thanks for the reply, I finally ended up using
`atomic{Store,Load}` with some memory ordering after reading
about them a bit. Atomic variables (`core.atomic!int`) would have
been a great feature, I have no further usecases for them and
they probably are a bit more complex for my understanding to make
a informed request right now, but will definitely make one when
my understanding improves in the future.
Thanks and regards,
Keivan Shah.
More information about the digitalmars-d-ldc
mailing list