Skip to content

Std fiber future

std:std.fiber.Future

Class Future#

Futures provide support for simple fiber synchronization.

A future allows you to synchronize two fibers by providing a way for one fiber to signal to another that an operation has completed.

The general usage pattern of futures is:

  • Fiber A creates a future and passes it to fiber B.

  • Fiber A then calls Get on the future. This will suspend Fiber A.

  • Fiber B performs some operation, then calls Set on the future. This will resume Fiber A.

A future can only be set once.

Constructors
New Creates a new future.
Methods
Get Gets the future's value.
Set Sets the future's value.