Wytch::Once
A thread-safe utility for executing a block exactly once.
Description
A thread-safe utility for executing a block exactly once.
Once ensures that a given block of code is executed only one time, even when called from multiple threads. After the first execution, subsequent calls are no-ops.
Methods
def call
Executes the block if it hasn't been executed yet.
Thread-safe: if multiple threads call this simultaneously, only one will execute the block.
- Returns:
- (void) —