Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoRoutineCounter ¶
type GoRoutineCounter interface { // Add adds the given delta to the count of active goroutines. // Call Add(1) before forking a goroutine, Add(-1) at the end of that goroutine. // Call Add(-1) just before waiting on something from another goroutine (e.g., // just before a `select`). // Call Add(1) just before doing something that unblocks a goroutine that is // waiting on that something. Add(delta int) }
GoRoutineCounter keeps track of the number of active goroutines working on/for something. This is a utility that makes such code more testable. The code uses this utility to report the number of active goroutines to the test code, so that the test code can advance a fake clock when and only when the code being tested has finished all the work that is ready to do at the present time.