Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
func (*Future) C ¶
C returns the channel on which the future value is to be set. Use instead of Get in case a more controlled select clause needs to be implemented.
Note that a value can be extracted only once (compared to Get where the set value can be read multiple times). After a value has been extracted, the channel is closed.
func (*Future) Get ¶
Get returns the future Value along with status flag, whether the returned value is valid (has been set). Note that a nil Value might be also valid.
Get blocks by default until a value has been set. However, WithTimeout can be used to modify the behaviour, as following:
- in case of a negative timeout value, Get will block as if the context wouldn't have been modified;
- in case the set timeout is 0 (zero), Get will return immediately no matter whether a Value has been set, or not;
- in case of a positive timeout value, Get will return on a set future Value or when the timeout expires (depending on witch one is triggered first);
See Future.Err for more info in case the status is set to false.
Click to show internal directories.
Click to hide internal directories.