A reference to the initialized variable
A typical use-case is to perform lazy but thread-safe initialization.
static class MySingleton { static MySingleton instance() { __gshared MySingleton inst; return initOnce!inst(new MySingleton); } } assert(MySingleton.instance !is null);
Initializes var with the lazy init value in a thread-safe manner.
The implementation guarantees that all threads simultaneously calling initOnce with the same var argument block until var is fully initialized. All side-effects of init are globally visible afterwards.