
Consistently use `time.Sleep`, instead of `runtime.Gosched`, to ensure all goroutines can make progress. `Gosched` wasn't working in the playground (ref #149). Also stop trying to compare operation rates. This was tenuous given e.g. how short the programs ran for, and with the `Sleep`s we now expect the rates to be similar anyways.
8 lines
177 B
Bash
8 lines
177 B
Bash
# Running the program shows that we executed about
|
|
# 40,000 operations.
|
|
$ go run atomic-counters.go
|
|
ops: 41419
|
|
|
|
# Next we'll look at mutexes, another tool for managing
|
|
# state.
|