absl::Barrier::Block

Blocks the calling thread until the thread threshold is reached.

Synopsis

Declared in <absl/synchronization/barrier.h>

bool
Block();

Description

Blocks the current thread, and returns only when the num_threads threshold of threads utilizing this barrier has been reached. Block() returns true for precisely one caller, which may then destroy the barrier.

Memory ordering: For any threads X and Y, any action taken by X before X calls Block() will be visible to Y after Y returns from Block().

Return Value

true for exactly one caller (which may destroy the barrier), and false for all other callers.