InterlockedIncrement, InterlockedCompareExchange, etc

David Nadlinger via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 28 15:14:44 PDT 2016


On Sunday, 28 August 2016 at 21:52:48 UTC, Illuminati wrote:
> Also D doesn't seem to have a volitile keyword anymore which is 
> required to prevent the compiler from prematurely optimizing 
> critical code.

It isn't. In fact, using volatile to achieve thread 
synchronisation (seeing as this is what the original post was 
about) in C is almost always wrong.

Depending on the use case, {atomic, volatile}{Load, Store}() 
should fulfil your needs.

  — David


More information about the Digitalmars-d-learn mailing list