Read/Write memory barriers in D?
Igor via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 13 04:37:31 PDT 2017
I am converting a C code that uses this macro:
#define CompletePastWritesBeforeFutureWrites _WriteBarrier();
_mm_sfence()
As far as I see core.atomic:atomicFence() is the equivalent of
_mm_sfence() but I can't find what would be the equivalent of
_WriteBarrier(). As far as I understand it is used just to tell
the compiler it can't rearrange instructions during optimizations
so subsequent memory writes happen before previous ones. Same for
_ReadBarrier().
More information about the Digitalmars-d-learn
mailing list