package promise
import "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/promise"
Index ¶
Types ¶
type WriteOnce ¶
type WriteOnce interface {
// Get reads the current value of this variable. If this
// variable is not set yet then this call blocks until this
// variable gets a value.
Get() interface{}
// Set normally writes a value into this variable, unblocks every
// goroutine waiting for this variable to have a value, and
// returns true. In the unhappy case that this variable is
// already set, this method returns false without modifying the
// variable's value.
Set(interface{}) bool
}
WriteOnce represents a variable that is initially not set and can be set once and is readable. This is the common meaning for "promise".
func NewWriteOnce ¶
NewWriteOnce makes a new thread-safe WriteOnce.
If `initial` is non-nil then that value is Set at creation time.
If a `Get` is waiting soon after the channel associated with the `doneCtx` becomes selectable (which never happens for the nil channel) then `Set(doneVal)` effectively happens at that time.
Source Files ¶
interface.go promise.go
- Version
- v0.36.0 (latest)
- Published
- Apr 22, 2026
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 4 days ago –
Tools for package owners.