hpx/collectives/latch.hpp

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

namespace hpx
namespace distributed
class latch : public components::client_base<latch, hpx::lcos::server::latch>

Public Functions

latch()
latch(std::ptrdiff_t count)

Initialize the latch

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

latch(hpx::id_type const &id)

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

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.

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.

latch(hpx::shared_future<hpx::id_type> &&id)
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.

Exceptions
  • Nothing.:

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.

Exceptions
  • Nothing.:

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 .

Exceptions
  • Nothing.:

bool is_ready() const

Returns: counter_ == 0. Does not block.

Exceptions
  • Nothing.:

bool try_wait() const

Returns: counter_ == 0. Does not block.

Exceptions
  • Nothing.:

void wait() const

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

Exceptions
  • Nothing.:

Private Types

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