future

Futures and promises.

This implementation follows the model of shared futures. Thus multiple waiters on the same future are allowed.

Functions

new() → promise, future

Constructor.

Creates a promise and its associated future and returns them.

future functions

get(self) → value

If result is available, returns result. Otherwise, blocks current fiber until result is ready and returns it.

promise functions

set_value(self, v)

Atomically stores the value into the shared state and makes the state ready.

set_error(self, e)

Atomically stores the exception e into the shared state and makes the state ready.