Documentation Home >> Headers >> <jss/experimental_latch.hpp> Header >> std::experimental::latch class

The latch class is a single use count-down latch that triggers when count events have occurred. Any number of threads may wait for the latch to trigger, and there is no requirement that the threads providing the count-down events have any explicit relationship with the waiting threads.

class latch{
public:
    explicit latch(ptrdiff_t count);
    ~latch();

    void count_down_and_wait();
    void count_down(ptrdiff_t n);
    bool is_ready() const noexcept;
    void wait() const;

    latch(latch const&)=delete;
    latch& operator=(latch const&)=delete;
};
Header

#include <experimental/latch>

See Also