gobyexample/examples/atomic-counters/atomic-counters.sh
Mark McGranaghan 6a58750728 Consistently use Sleep in state-management examples
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.
2016-12-27 10:13:03 -08:00

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.