Freigeben über


once_flag Structure

Represents a struct that is used with the template function call_once to ensure that initialization code is called only once, even in the presence of multiple threads of execution.

struct once_flag
{
   constexpr once_flag() noexcept;
   once_flag(const once_flag&);
   once_flag& operator=(const once_flag&);
};

Remarks

The once_flagstruct has only a default constructor.

Objects of type once_flag can be created, but they cannot be copied.

Requirements

Header: mutex

Namespace: std

See Also

Reference

<mutex>

Other Resources

C++ Standard Library Header Files