Skip to content
FutureBlitz

    Install

    Import std.concurrent.lazy

    std.concurrent.lazy

    Lazy<T>: a value made the first time a thread asks for it, by the Sendable Func it was given, once however many threads ask at once: the others wait while it's made, and each gets the same value. It's a Shared Class, so a Const or a parameter shares one with the work that Spawn and Thread.Start run.

    std/concurrent/lazy.fb

    Types

    Lazy class

    Public Shared Class Lazy<T: Sendable>

    A value made the first time a thread asks for it, once however many threads ask at once.

    std/concurrent/lazy.fb, line 13

    • Public New(maker: Sendable Func(): T) constructor #

      A Lazy whose value maker makes, the first time Value is read.

    • @PanicsAtCaller Public Property Value: T property #

      The value, which the first read makes, on the thread that reads it, while the reads on other threads wait for it. Panics when the maker reads its own Lazy's Value, which would wait for itself forever.

    • Public Property IsMade: Bool property #

      Whether the value is made, which a thread that reads it while it's being made doesn't wait for.

    Report an issue with this page or with FutureBlitz on GitHub.