const class concurrent::Future
sys::Obj concurrent::Future
@Js
Future represents the result of an asynchronous computation.
See Actors
- cancel
-
Void cancel()
Cancel this computation if it has not begun processing. No guarantee is made that the computation will be cancelled.
- complete
-
Complete the future successfully with given value. Raise an exception if value is not immutable or the future is already complete (ignore this call if cancelled). Return this.
TODO: prototype feature
- completeErr
-
Complete the future with a failure condition using given exception. Raise an exception if the future is already complete (ignore this call if cancelled). Return this.
TODO: prototype feature
- get
-
Obj? get(Duration? timeout := null)
Block current thread until result is ready. If timeout occurs then TimeoutErr is raised. A null timeout blocks forever. If an exception was raised by the asynchronous computation, then it is raised to the caller of this method.
- isCancelled
-
@Deprecated { msg="Use Future.state" }
Bool isCancelled()Return if this message has been cancelled.
- isDone
-
@Deprecated { msg="Use Future.state" }
Bool isDone()Return true if the asynchronous computation has completed processing. Completion may be due to the computation returning a result, throwing an exception, or cancellation.
- make
-
new make()
Construct a future in the pending state. TODO: prototype feature
- state
-
FutureState state()
Current state of asynchronous computation