Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header/latch"

From cppreference.com
< cpp‎ | header
(P1135R6 latch)
 
(Fix name of header in title)
Line 1: Line 1:
{{cpp/header/title|thread}}
+
{{cpp/header/title|latch}}
 
{{cpp/header/navbar}}
 
{{cpp/header/navbar}}
 
This header is part of the [[cpp/thread|thread support]] library.
 
This header is part of the [[cpp/thread|thread support]] library.

Revision as of 11:20, 9 March 2020

 
 
Standard library headers
 

This header is part of the thread support library.

Classes

(C++20)
single-use thread barrier
(class) [edit]

Synopsis

namespace std {
  class latch;
}

Class 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;  // exposition only
  };
}