Import std.concurrent.lazy
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.
Examples
Const settings = Lazy<String>(Function() => "loaded")
Expect(!settings.IsMade)
Expect(settings.Value == "loaded")
Expect(settings.IsMade)std/concurrent/lazy.fb, line 24
-
A Lazy whose value
makermakes, the first time Value is read. -
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.
-
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.