close
名前空間
変種

標準ライブラリヘッダ <barrier>

提供: cppreference.com
 
 
 

このヘッダはスレッドサポートライブラリの一部です。

クラス

(C++20)
再使用可能なスレッドバリア
(クラステンプレート) [edit]

概要

namespace std {
  template<class CompletionFunction = /* see description */>
    class barrier;
}

クラステンプレート std::barrier

namespace std {
  template<class CompletionFunction = /* see description */>
  class barrier {
  public:
    using arrival_token =  /* see description */;

    static constexpr ptrdiff_t max() noexcept;

    constexpr explicit barrier(ptrdiff_t expected,
                               CompletionFunction f = CompletionFunction());
    ~barrier();

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

    [[nodiscard]] arrival_token arrive(ptrdiff_t update = 1);
    void wait(arrival_token&& arrival) const;

    void arrive_and_wait();
    void arrive_and_drop();

  private:
    CompletionFunction completion;      // exposition only
  };
}