folly::compact_once_flag

An alternative flag that can be used with call_once that uses only 1 byte. Uses a 3-state std::atomic<uint8_t> with wait/notify for synchronization.

Synopsis

Declared in <folly/synchronization/CallOnce.h>

class compact_once_flag;

Member Functions

NameDescription
compact_once_flag [constructor]Constructors
operator= [deleted]Deleted copy assignment; once-flags are not copyable.

Friends

NameDescription
folly::try_call_onceLike call_once, but using a boolean return type to signal pass/fail rather than throwing exceptions.
folly::set_onceSets a flag, as if call_once(flag, []{}) was called.
folly::reset_onceResets a flag.
folly::test_onceTests whether any invocation to call_once with the given flag has succeeded.
folly::call_onceDrop-in replacement for std::call_once.