Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FutureTag tagFuture
FutureTag is the Tag for Future objects. Activate activates the future's result if it is available and returns self if it is not. CloneValue returns a new Future with no coroutine.
Functions ¶
Types ¶
type Future ¶
type Future struct { // M is an atomic flag for whether the value has been computed. M uintptr // Value is the computed result, or nil while waiting for it. Value *iolang.Object // Coro is the coroutine which will fill in the value. Coro *iolang.VM }
A Future is a placeholder object that will be filled in by a dedicated coroutine.
func (*Future) Wait ¶
Wait spins until the value is ready. While spinning, the future monitors the coroutine's remote control flow channel. The value is returned if it is ready, otherwise the Stop that ceased monitoring. Panics if the coroutine hasn't started yet.
NOTE: If Wait returns a Stop, then that Stop was sent to the waiting coroutine, not the Future's.
Click to show internal directories.
Click to hide internal directories.