Examples using... "sync/atomic"

Recent
The following example shows how to maintain a scalable frequently read, but infrequently updated data structure using copy-on-write idiom.
The following example shows how to use Value for periodic program config updates and propagation of the changes to worker goroutines.
Here we use the built-in synchronization features of goroutines and channels to achieve synchronized access to shared state. This channel-based approach aligns with Go’s ideas of sharing memory by communicating and having each piece of data owned by exactly 1 goroutine.