apiserverk8s.io/apiserver/pkg/util/flowcontrol/counter Index | Files

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.

type NoOp

type NoOp struct{}

NoOp is a GoRoutineCounter that does not actually count

func (NoOp) Add

func (NoOp) Add(int)

Add would adjust the count, if a count were being kept

Source Files

interface.go noop.go

Version
v0.19.9
Published
Mar 18, 2021
Platform
js/wasm
Last checked
2 seconds ago

Tools for package owners.