MCPcopy Create free account
hub / github.com/3rdparty/libprocess / after

Function after

include/process/future.hpp:1548–1569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1546
1547template <typename T>
1548void after(
1549 const std::shared_ptr<Latch>& latch,
1550 const std::shared_ptr<Promise<T>>& promise,
1551 const std::shared_ptr<Option<Timer>>& timer,
1552 const Future<T>& future)
1553{
1554 CHECK(!future.isPending());
1555 if (latch->trigger()) {
1556 // If this callback executes first (i.e., we triggered the latch)
1557 // it must be the case that `timer` is still some and we can try
1558 // and cancel the timer.
1559 CHECK_SOME(*timer);
1560 Clock::cancel(timer->get());
1561
1562 // We also force the timer to get deallocated so that there isn't
1563 // a cicular reference of the timer with itself which keeps around
1564 // a reference to the original future.
1565 *timer = None();
1566
1567 promise->associate(future);
1568 }
1569}
1570
1571} // namespace internal {
1572

Callers

nothing calls this directly

Calls 4

isPendingMethod · 0.80
triggerMethod · 0.80
associateMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected