stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches

Detailed Description

Blocking wait helpers for futures (await, blocking_get, etc.).

Functions

template<class F>
auto stlab::invoke_waiting (F &&f)
 Assumes f will block waiting; on the portable task system, wakes the pool or adds a worker (up to the limit) before calling f.
template<class T>
auto stlab::await (future< T > &&x) -> T
 Synchronously wait for the result x. If x resolves as an exception, the exception is rethrown. When using the portable task system, an additional thread is added to the pool if no threads are available and the maximum number of threads has not been reached.
template<class T>
auto stlab::await (const future< T > &x) -> T
 Equivalent to await(copy(x)).
template<class T>
auto stlab::await_for (future< T > &&x, const std::chrono::nanoseconds &timeout) -> future< T >
template<class T>
auto stlab::await_for (const future< T > &x, const std::chrono::nanoseconds &timeout) -> future< T >
 Equivalent to await_for(copy(x), timeout).
template<class T>
auto stlab::blocking_get (future< T > x) -> T
template<class T>
auto stlab::blocking_get_for (future< T > x, const std::chrono::nanoseconds &timeout) -> future< T >
template<class T>
auto stlab::blocking_get (future< T > x, const std::chrono::nanoseconds &timeout) -> decltype(x.get_try())

Function Documentation

◆ blocking_get() [1/2]

template<class T>
auto stlab::blocking_get ( future< T > x) -> T

Waits until x is ready. Consumes a thread while blocked, increasing contention and risking deadlock; subsequent work on the waiting thread is stalled. Prefer continuations (then, recover, when_all, etc.).

◆ blocking_get() [2/2]

template<class T>
auto stlab::blocking_get ( future< T > x,
const std::chrono::nanoseconds & timeout ) -> decltype(x.get_try())

◆ blocking_get_for()

template<class T>
auto stlab::blocking_get_for ( future< T > x,
const std::chrono::nanoseconds & timeout ) -> future< T >