class barrier

Defined at line 40 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

A barrier is utility class for monitoring pending promises and ensuring they have completed when

|barrier.sync| completes. This class is used to mark promises with |barrier.wrap|, without

changing their order, but allowing a caller to later invoke |sync| and ensure they have

completed.

EXAMPLE

// Issue tracked work, wrapped by the barrier.

fpromise::barrier barrier;

auto work = fpromise::make_promise([] { do_work(); });

executor.schedule_task(work.wrap_with(barrier));

auto more_work = fpromise::make_promise([] { do_work_but_more(); });

executor.schedule_task(more_work.wrap_with(barrier));

// Ensure that all prior work completes, using the same barrier.

barrier.sync().and_then([] {

// |work| and |more_work| have been completed.

});

See documentation of |fpromise::promise| for more information.

Public Methods

void barrier ()

Defined at line 9 of file ../../sdk/lib/fit-promise/barrier.cc

void ~barrier ()

Defined at line 17 of file ../../sdk/lib/fit-promise/barrier.cc

void barrier (const barrier & )

Defined at line 45 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

void barrier (barrier && )

Defined at line 46 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

barrier & operator= (const barrier & )

Defined at line 47 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

barrier & operator= (barrier && )

Defined at line 48 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

template <typename Promise>
decltype(auto) wrap (Promise promise)

Returns a new promise which, after invoking the original |promise|, may update sync() callers

if they are waiting for all prior work to complete.

This method is thread-safe.

Defined at line 55 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h

fpromise::promise<void, void> sync ()

Returns a promise which completes after all previously wrapped work has completed.

This method is thread-safe.

Defined at line 88 of file ../../sdk/lib/fit-promise/include/lib/fpromise/barrier.h