命名空间
变体
操作

标准库头文件 <barrier> (C++20)

来自 cppreference.cn
< cpp‎ | header
 
 
标准库头文件
算法
<algorithm>
<numeric>
字符串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文本处理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
时间
<chrono> (C++11)
<ctime>
C 兼容性
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此头文件是 线程支持 库的一部分。

(C++20)
可重用的线程栅栏
(类模板) [编辑]

[编辑] 概要

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;
 
    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
  };
}