On Friday, 11 March 2022 at 15:52:04 UTC Gregg Townsend wrote:

> Two concurrent calls of Put can load identical head and tail values and 
> then store in the same slot.
>

Correct, but that's not a valid way to use this code. See 
https://github.com/QuantumLeaps/lock-free-ring-buffer#lock-free-restrictions

*"The ring buffer does not require any "locking" (mutual exclusion 
mechanism) as long as the following restrictions are met:*

   1. *Only one thread/interrupt can produce data into the ring buffer*
   2. *Only one thread/interrupt can consume data from the ring buffer*

*In other words, a given LFRB can be used only by one pair of producer/ 
consumer threads/interrupts. Fortunately, this is the most frequently 
encountered scenario."*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2433b1d4-1d5c-4096-8de8-593086cf655fn%40googlegroups.com.

Reply via email to