On 01/09/2016 04:51 PM, Jin wrote: > I just add atomic fence for push and take: > > this.messages[ this.tail ] = value; > atomicFence; > this.tail = ( this.tail + 1 ) % this.size;
Don't do this, memory fences are expensive. This is what you need for a spsc queue. https://github.com/MartinNowak/lock-free/commit/233739262c14e00866a60f4a6a86c1b979ac968b