ThreadSchedule 2.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
futures.hpp File Reference

Combinators for std::future: when_all, when_any, when_all_settled. More...

#include "expected.hpp"
#include <chrono>
#include <exception>
#include <future>
#include <utility>
#include <vector>
Include dependency graph for futures.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  threadschedule

Functions

template<typename T>
auto threadschedule::when_all (std::vector< std::future< T > > &futures) -> std::vector< T >
 Block until all futures complete, returning results in submission order.
void threadschedule::when_all (std::vector< std::future< void > > &futures)
 Block until all void futures complete.
template<typename T>
auto threadschedule::when_all_settled (std::vector< std::future< T > > &futures) -> std::vector< expected< T, std::exception_ptr > >
 Block until all futures complete, returning an expected per slot.
auto threadschedule::when_all_settled (std::vector< std::future< void > > &futures) -> std::vector< expected< void, std::exception_ptr > >
 Block until all void futures complete, returning an expected per slot.
template<typename T>
auto threadschedule::when_any (std::vector< std::future< T > > &futures) -> std::pair< size_t, T >
 Block until the first future becomes ready.
auto threadschedule::when_any (std::vector< std::future< void > > &futures) -> size_t
 Block until the first void future becomes ready.

Detailed Description

Combinators for std::future: when_all, when_any, when_all_settled.

These utilities simplify waiting on multiple futures produced by thread pool submissions.

Definition in file futures.hpp.