Wait-free thread communication

Jin via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 9 08:22:12 PST 2016


On Saturday, 9 January 2016 at 16:05:34 UTC, Ola Fosheim Grøstad 
wrote:
> You need it in the tests.

If memory writes will reorder, then current tests will fail. 
Memory reades can be in any order.

On Saturday, 9 January 2016 at 16:05:34 UTC, Ola Fosheim Grøstad 
wrote:
> I haven't used atomics in D, but you have
>
>   atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(ref const 
> shared T val)
>   atomicStore(MemoryOrder ms = MemoryOrder.seq, T, V1)(ref 
> shared T val, V1 newval)

I do not understand how to use its right. So i simple use 
atomicFence. Performance does not degrade.


More information about the Digitalmars-d mailing list