package counter
import "k8s.io/apiserver/pkg/util/flowcontrol/counter"
Index ¶
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.
Source Files ¶
interface.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Last checked
- 1 hour ago –
Tools for package owners.