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

Method then

include/process/future.hpp:1576–1595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1574template <typename T>
1575template <typename X>
1576Future<X> Future<T>::then(lambda::CallableOnce<Future<X>(const T&)> f) const
1577{
1578 std::unique_ptr<Promise<X>> promise(new Promise<X>());
1579 Future<X> future = promise->future();
1580
1581 lambda::CallableOnce<void(const Future<T>&)> thenf = lambda::partial(
1582 &internal::thenf<T, X>, std::move(f), std::move(promise), lambda::_1);
1583
1584 onAny(std::move(thenf));
1585
1586 onAbandoned([=]() mutable {
1587 future.abandon();
1588 });
1589
1590 // Propagate discarding up the chain. To avoid cyclic dependencies,
1591 // we keep a weak future in the callback.
1592 future.onDiscard(lambda::bind(&internal::discard<T>, WeakFuture<T>(*this)));
1593
1594 return future;
1595}
1596
1597
1598template <typename T>

Callers 15

FutureClass · 0.95
spliceFunction · 0.45
toggleMethod · 0.45
convertFunction · 0.45
sendMethod · 0.45
_sendMethod · 0.45
connectFunction · 0.45
sendfileFunction · 0.45
streamFunction · 0.45
sendFunction · 0.45
runMethod · 0.45
stopMethod · 0.45

Calls 4

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

Tested by 11

runMethod · 0.36
handlerMethod · 0.36
func1Method · 0.36
func2Method · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
on_acceptFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
await_subprocessFunction · 0.36
TESTFunction · 0.36