Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::once_flag

      From cppreference.com
      <cpp‎ |thread
       
       
      Concurrency support library
      Threads
      (C++11)
      (C++20)
      this_thread namespace
      (C++11)
      (C++11)
      (C++11)
      Cooperative cancellation
      Mutual exclusion
      Generic lock management
      (C++11)
      (C++11)
      once_flag
      (C++11)
      (C++11)
      Condition variables
      (C++11)
      Semaphores
      Latches and Barriers
      (C++20)
      (C++20)
      Futures
      (C++11)
      (C++11)
      (C++11)
      Safe reclamation
      Hazard pointers
      Atomic types
      (C++11)
      (C++20)
      Initialization of atomic types
      (C++11)(deprecated in C++20)
      (C++11)(deprecated in C++20)
      Memory ordering
      (C++11)(deprecated in C++26)
      Free functions for atomic operations
      Free functions for atomic flags
       
      Defined in header<mutex>
      class once_flag;
      (since C++11)

      The classstd::once_flag is a helper structure forstd::call_once.

      An object of typestd::once_flag that is passed to multiple calls tostd::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 neither copyable nor movable.

      Contents

      [edit]Member functions

      std::once_flag::once_flag

      constexpr once_flag()noexcept;

      Constructs anonce_flag object. The internal state is set to indicate that no function has been called yet.

      Parameters

      (none)


      [edit]See also

      (C++11)
      invokes a function only once even if called from multiple threads
      (function template)[edit]
      C documentation foronce_flag
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/thread/once_flag&oldid=134624"

      [8]ページ先頭

      ©2009-2025 Movatter.jp