Documentation Home >> Headers >> <mutex> Header >> std::once_flag class

Instances of std::once_flag are used with std::call_once to ensure that a particular function is called exactly once, even if multiple threads invoke the call concurrently.

Instances of std::once_flag are neither CopyConstructible, CopyAssignable, MoveConstructible nor MoveAssignable.

struct once_flag
    constexpr once_flag();

    once_flag(once_flag const& ) = delete;
    once_flag& operator=(once_flag const& ) = delete;

// just::thread specific
#define _JSS_STATIC_ONCE_FLAG(name) [`unspecified]
#define _JSS_EXTERN_ONCE_FLAG(name) [`unspecified]

#include <mutex>

See Also