Standard library header <latch> (C++20)
From cppreference.net
C++
Standard library headers
此头文件是 线程支持 库的组成部分。
类 |
|
|
(C++20)
|
一次性线程屏障
(类) |
概要
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; // 仅用于说明 }; }