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

Method repair

include/process/future.hpp:1670–1688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1668
1669template <typename T>
1670Future<T> Future<T>::repair(
1671 lambda::CallableOnce<Future<T>(const Future<T>&)> f) const
1672{
1673 std::unique_ptr<Promise<T>> promise(new Promise<T>());
1674 Future<T> future = promise->future();
1675
1676 onAny(lambda::partial(
1677 &internal::repair<T>, std::move(f), std::move(promise), lambda::_1));
1678
1679 onAbandoned([=]() mutable {
1680 future.abandon();
1681 });
1682
1683 // Propagate discarding up the chain. To avoid cyclic dependencies,
1684 // we keep a weak future in the callback.
1685 future.onDiscard(lambda::bind(&internal::discard<T>, WeakFuture<T>(*this)));
1686
1687 return future;
1688}
1689
1690
1691template <typename T>

Callers 1

TESTFunction · 0.80

Calls 4

onAnyFunction · 0.85
bindFunction · 0.85
futureMethod · 0.80
abandonMethod · 0.80

Tested by 1

TESTFunction · 0.64