[#absl-once_flag] = xref:absl.adoc[absl]::once_flag :relfileprefix: ../ :mrdocs: Objects of this type are used to distinguish calls to `call_once()` and ensure the provided function is only invoked once across all threads. This type is not copyable or movable. However, it has a `constexpr` constructor, and is safe to use as a namespace‐scoped global variable. == Synopsis Declared in `<absl/base/call_once.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class once_flag; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/once_flag/2constructor-0c.adoc[`once_flag`] [.small]#[constructor]# | Constructors | xref:absl/once_flag/operator_assign.adoc[`operator=`] [.small]#[deleted]# | Deleted: `once_flag` is not copy‐assignable. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/call_once.adoc[`call_once`] | For all invocations using a given `once_flag`, invokes a given `fn` exactly once across all threads. The first call to `call_once()` with a particular `once_flag` argument (that does not throw an exception) will run the specified function with the provided `args`; other calls with the same `once_flag` argument will not run the function, but will wait for the provided function to finish running (if it is still running). |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#