Skip to content

Future

This provides a placeholder that will eventually hold the value returned from a coroutine when it becomes available.

graph BT
N1["Future"] -->|inherits| N2["Any"];

Characteristics

Quality Value
Inherits global.Any
Extends N/A
Decorators #sealed;
Is enum false
Is sealed true
Is extern false
Is abstract false
Is generator false
Has value semantics false
Has stored properties true
Should register destructor false
Has atomic memory false
Is copy assignable false
Is zero initializable false

Methods

construct

#default
#Gambol.function.alwaysinline
construct (s strictly @Self) -> Self

wait

#Gambol.function.alwaysinline
wait (s @Self) -> Nil
suspends the current thread until a value becomes available.


signal

#Gambol.function.alwaysinline
signal (s @Self) -> Nil
used the by AsyncLoop to signal the availability of a value.


get_value

#Gambol.function.alwaysinline
get_value (s @Self) -> Dynamic
will return the value associated with this Future. Must be called after a value becomes available. If the coroutine raised an exception, this will also raise the same exception.


Casts To

  • Bool: true if a value is available, false otherwise

Properties

value

value Dynamic

The property that holds the value


exception

exception nom Exception?

holds the exception if the coroutine raised an exception.


has_value

has_value Bool

true if a value is available, false otherwise. Must be checked atomically.


__sem

__sem Semaphore