Support `_Atomic`
Gnimuc opened this issue · 2 comments
It looks like _Atomic
can be supported by simply using the @atomic
macro: https://docs.julialang.org/en/v1/manual/multi-threading/#man-atomics
Need to study the memory model carefully to make sure both Julia's representation and C/C++'s representation are compatible.
If you use the @atomic
macro for some structure member, the structure must be mutable.
I have just checked that using @atomic x::T
in a (mutable) Julia structure seems to be a more correct replacement for C member defined as _Atomic T x;
than declaring them as x::Threads.Atomic{T}
. With @atomic
alignemnt and size seems to be preserved which is not the case with Threads.Atomic{T}
because the latter yields a reference to a mutable Julia object.