Compiler optimization breaks multi-threaded code
stephan
none at example.com
Wed Nov 17 09:41:57 PST 2010
> atomicOp uses a CAS loop for the RMW operations.
Ignore my comment. I should have looked at the code in core.atomic
before commenting. I just had one test case with atomicOp!("+=") that
worked, and assumed that atomicOp!("+=") was implemented with "lock xadd".
> I'm thinking of exposing atomicStore and atomicLoad in core.atomic so folks have something to use until the compiler work is taken care of.
This would be a good solution. Not only does it solve this ordering
issue, but it is actually what I want to do with a shared variable while
I am already within a critical section anyways.
More information about the Digitalmars-d
mailing list