Wait-free thread communication
Jin via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jan 9 07:51:51 PST 2016
On Saturday, 9 January 2016 at 14:20:18 UTC, Andy Smith wrote:
> I'm a little worried you have no volatile writes or fences
> around your code when you 'publish' an event using head/tail
> etc. It looks like it's working but how are you ensuring no
> compiler/CPU reordering is ocurring. Does x86_64 actually allow
> you to get away with this? I know its memory model is stricter
> than others...
I just add atomic fence for push and take:
this.messages[ this.tail ] = value;
atomicFence;
this.tail = ( this.tail + 1 ) % this.size;
More information about the Digitalmars-d
mailing list