Namespaces
Variants

Standard library header <latch> (C++20)

From cppreference.net
Standard library headers

이 헤더는 스레드 지원 라이브러리의 일부입니다.

클래스

(C++20)
1회용 스레드 배리어
(클래스)

시놉시스

namespace std {
  class latch;
}

클래스 std::latch

namespace std {
  class latch {
  public:
    static constexpr ptrdiff_t max() noexcept;
    constexpr explicit latch(ptrdiff_t expected);
    ~latch();
    latch(const latch&) = delete;
    latch& operator=(const latch&) = delete;
    void count_down(ptrdiff_t update = 1);
    bool try_wait() const noexcept;
    void wait() const;
    void arrive_and_wait(ptrdiff_t update = 1);
  private:
    ptrdiff_t counter;  // 설명용으로만 사용
  };
}