81class pipelining :
public std::enable_shared_from_this<pipelining<E>>
99 static std::shared_ptr<pipelining>
create(
int depth)
101 util::Preconditions::check_positive(depth,
"depth must be positive");
103 return std::shared_ptr<pipelining>(
new pipelining(depth));
118 std::vector<boost::optional<E>> result;
119 result.reserve(futures_.size());
120 auto result_futures = when_all(futures_.begin(), futures_.end());
121 for (
auto& f : result_futures.get()) {
122 result.emplace_back(f.get());
136 void add(boost::future<boost::optional<E>> future)
140 futures_.push_back(future.share());
146 util::Preconditions::check_positive(depth,
"depth must be positive"))
152 for (
auto& f : futures_) {
157 if (usedPermits >= permits_) {
158 decltype(futures_) outStandingFutures;
159 for (
auto& f : futures_) {
161 outStandingFutures.push_back(f);
165 if (!outStandingFutures.empty()) {
166 boost::when_any(outStandingFutures.begin(),
167 outStandingFutures.end())
174 std::vector<boost::shared_future<boost::optional<E>>> futures_;