[thread.once.onceflag]

# 32 Concurrency support library [[thread]](./#thread)

## 32.6 Mutual exclusion [[thread.mutex]](thread.mutex#thread.once.onceflag)

### 32.6.7 Call once [[thread.once]](thread.once#onceflag)

#### 32.6.7.1 Struct once_flag [thread.once.onceflag]

[ð](#lib:once_flag)

namespace std {struct once_flag {constexpr once_flag() noexcept;

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

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L9379)

The class once_flag is an opaque data structure that call_once uses to
initialize data without causing a data race or deadlock[.](#1.sentence-1)

[ð](#lib:once_flag_)

`constexpr once_flag() noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L9389)

*Synchronization*: The construction of a once_flag object is not synchronized[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L9393)

*Postconditions*: The object's internal state is set to indicate to an invocation ofcall_once with the object as its initial argument that no function has been
called[.](#3.sentence-1)
