llvm::call_once

Execute the function specified as a parameter once.

Synopsis

Declared in <llvm/Support/Threading.h>

template<
    typename Function,
    typename... Args>
void
call_once(
    once_flag& flag,
    Function&& F,
    Args&&... ArgList);

Description

Typical usage:


void foo() {...};
...
static once_flag flag;
call_once(flag, foo);

Parameters

NameDescription
flagFlag used for tracking whether or not this has run.
FFunction to call once.
ArgListArguments forwarded to F.