Re: [go-nuts] Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread burak serdar
Based on my reading of the Go memory model, this algorithm sketch is memory-race free. However, there is a race condition. Here's the reason: The writer issues a synchronized-write to array pointer, and another synchronized-write to the array len. A reader issues a synchronized read. the

[go-nuts] Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread Konstantin Khomoutov
Hi! I would like to receive clarifications, if possible, on Go memory model guarantees about non-atomic load and stores when intermixed with atomic load and stores. I'm reviewing a piece of code which, simplified, works as follows: - There is a single "writer" goroutine which - Allocates