This variant is intended to simplify do_for_each idiom where the
iterators begin() and end() will be implicit.
Allowing the user to do something as follow:
return do_for_each(map, [] { ... });
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Add a when_all() variant that waits for a runtime variable number of
futures, all of the same type. The function returns a future containing
a vector of all input futures, each in ready state, containing either
a result or an exception.
Currently we have one version of when_all(), that accepts a compile
type variable number of independently typed futures. We wish to add more
overloads, but for that, we must ensure that this variant doesn't match them.
Accomplish this by requiring that the first argument be a future, and don't
accept any other type.
Some of the core functions accept functions returning either an immediate
type, or a future, and return a future in either case (e.g. smp::submit_to()).
To make it easier to metaprogram with these functions, provide a utility
that computes the return type, futurize<T>:
futurize_t<bar> => future<bar>
futurize_t<void> => future<>
futurize_t<future<bar>> => future<bar>
The current shared_ptr implementation is efficient, but does not support
polymorphic types.
Rename it in order to make room for a polymorphic shared_ptr.
This function belongs to a group of functions for associating futures
with time points. Currently there's only now(), which servers as a shorthand
for make_ready_future<>().
Recursion takes up space on stack which takes up space in caches which
means less room for useful data.
In addition to that, a limit on iteration count can be larger than the
limit on recursion, because we're not limited by stack size here.
Also, recursion makes flame-graphs really hard to analyze because
keep_doing() frames appear at different levels of nesting in the
profile leading to many short "towers" instead of one big tower.
This change reuses the same counter for limiting iterations as is used
to limit the number of tasks executed by the reactor before polling.
There was a run-time parameter added for controlling task quota.
when_all(f1, f2) returns a future that becomes ready when all input futures
are ready. The return value is a tuple with all input futures, so the values
and exceptions can be accessed.