Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WriteOnce ¶ added in v0.18.0
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 ¶ added in v0.23.0
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.
Click to show internal directories.
Click to hide internal directories.