Difference between revisions of "cpp/thread/once flag"
From cppreference.com
m (Shorten template names. Use {{lc}} where appropriate.) |
|||
Line 5: | Line 5: | ||
}} | }} | ||
− | The class {{tt|std::once_flag}} is a helper structure for {{ | + | The class {{tt|std::once_flag}} is a helper structure for {{lc|std::call_once}}. |
− | An object of type {{tt|std::once_flag}} that is passed to multiple calls to {{ | + | An object of type {{tt|std::once_flag}} that is passed to multiple calls to {{lc|std::call_once}} allows those calls to coordinate with each other such that only one of the calls will actually run to completion. |
{{tt|std::once_flag}} is noncopyable. | {{tt|std::once_flag}} is noncopyable. | ||
Line 27: | Line 27: | ||
===See also=== | ===See also=== | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc inc | cpp/thread/dcl list call_once}} |
− | {{ | + | {{dsc end}} |
[[de:cpp/thread/once flag]] | [[de:cpp/thread/once flag]] |
Revision as of 20:01, 31 May 2013
Defined in header <mutex>
|
||
class once_flag; |
(since C++11) | |
The class std::once_flag
is a helper structure for std::call_once.
An object of type std::once_flag
that is passed to multiple calls to std::call_once allows those calls to coordinate with each other such that only one of the calls will actually run to completion.
std::once_flag
is noncopyable.
Contents |
Member functions
std::once_flag::once_flag
once_flag(); |
||
Constructs an once_flag
object. The internal state is set to indicate that no function has been called yet.
Parameters
(none)
Exceptions
noexcept specification:
noexcept