hpx::distributed::latch#

Defined in header hpx/latch.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx

Top level HPX namespace.

namespace distributed
class latch : public components::client_base<latch, hpx::lcos::server::latch>#
#include <latch.hpp>

Latch is an implementation of a synchronization primitive that allows multiple threads to wait for a shared event to occur before proceeding. This latch can be invoked in a distributed application.

For a local only latch

See also

hpx::latch.

Public Functions

latch() = default#
explicit latch(std::ptrdiff_t count)#

Initialize the latch

Requires: count >= 0. Synchronization: None Postconditions: counter_ == count.

inline latch(hpx::id_type const &id)#

Extension: Create a client side representation for the existing server::latch instance with the given global id id.

inline latch(hpx::future<hpx::id_type> &&f)#

Extension: Create a client side representation for the existing server::latch instance with the given global id id.

inline latch(hpx::shared_future<hpx::id_type> const &id)#

Extension: Create a client side representation for the existing server::latch instance with the given global id id.

inline latch(hpx::shared_future<hpx::id_type> &&id)#
inline void count_down_and_wait()#

Decrements counter_ by 1 . Blocks at the synchronization point until counter_ reaches 0.

Requires: counter_ > 0.

Synchronization: Synchronizes with all calls that block on this latch and with all is_ready calls on this latch that return true.

Throws

Nothing.

inline void arrive_and_wait()#

Decrements counter_ by update . Blocks at the synchronization point until counter_ reaches 0.

Requires: counter_ > 0.

Synchronization: Synchronizes with all calls that block on this latch and with all is_ready calls on this latch that return true.

Throws

Nothing.

inline void count_down(std::ptrdiff_t n)#

Decrements counter_ by n. Does not block.

Requires: counter_ >= n and n >= 0.

Synchronization: Synchronizes with all calls that block on this latch and with all is_ready calls on this latch that return true .

Throws

Nothing.

inline bool is_ready() const noexcept#

Returns: counter_ == 0. Does not block.

Throws

Nothing.

inline bool try_wait() const noexcept#

Returns: counter_ == 0. Does not block.

Throws

Nothing.

inline void wait() const#

If counter_ is 0, returns immediately. Otherwise, blocks the calling thread at the synchronization point until counter_ reaches 0.

Throws

Nothing.

Private Types

typedef components::client_base<latch, hpx::lcos::server::latch> base_type#
namespace lcos