Clarify reading op non-atomically

This commit is contained in:
Eli Bendersky
2019-09-05 13:26:08 -07:00
parent ef8f0e3831
commit b70c15adaa
3 changed files with 28 additions and 6 deletions

View File

@@ -42,5 +42,11 @@ func main() {
// Wait until all the goroutines are done.
wg.Wait()
// It's safe to access `ops` now because we know
// no other goroutine is writing to it. Reading
// atomics safely while they are being updated is
// also possible, using functions like
// `atomic.LoadUint64`.
fmt.Println("ops:", ops)
}

View File

@@ -1,2 +1,2 @@
103c9b7d036e3a5c14dc481755b78b10dc9f894e
GRkVf6J1--B
8ebec0be3b167021c96b8b497d0e8c0a2ea99385
F2pJfduyQiA