package promise

import "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/promise"

Index

Functions

func NewCountingWriteOnce

func NewCountingWriteOnce(activeCounter counter.GoRoutineCounter, lock sync.Locker, initial interface{}, doneCh <-chan struct{}, doneVal interface{}) promiseifc.WriteOnce

NewCountingWriteOnce creates a WriteOnce that uses locking and counts goroutine activity.

The final three arguments are like those for a regular WriteOnce factory: - an optional initial value, - an optional "done" channel, - the value that is Set after the "done" channel becomes selectable. Note that for this implementation, the reaction to `doneCh` becoming selectable does not wait for a Get. If `doneCh != nil` then the caller promises to close it reasonably promptly (to the degree allowed by the Go runtime scheduler), and increment the goroutine counter before that. The WriteOnce's Get method must be called without the lock held. The WriteOnce's Set method must be called with the lock held.

Source Files

counting.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
1 hour ago

Tools for package owners.