Open abbychau opened 2 months ago
the ever original idea is:
cas holder.readweite from 0 to 2 must not be failed, logically. so, line 122 would never get in control. line 122-126 is just a defensive block. it could be remove safely.
if it really reached, the enqueue or dequeue would be failure.
120-123 looks like a potential spinlock to me, but 122 looks like getting away from the spin. so i asked why 121 and 122 works like this. Kind of unclear to me about the whole retry block ^^; Could you give a bit explanation?
Wanna know if it is an unprotected critical zone between 121 and 122
https://github.com/hedzr/go-ringbuf/blob/73252d2c16b7c25981c2ac6fdba56feb863e7bd4/mpmc/rb.go#L122