libcoro  1.0
Coroutine support library for C++20

◆ then()

template<typename T >
template<std::invocable<> Fn>
bool coro::future< T >::then ( Fn &&  fn)
inline

Sets function which is called once future is resolved (always)

The function is called always, regardless on whether the future is already resolved

Parameters
fnfunction to call when future is resolved
Return values
truefunction will be called in future
falsefunction was called immediatelly, because the future was already resolved

(you can ignore return value)

Note
There can be only one callback at time. Attempt to call this function twice can cause that previous function is destroyed without calling

Definition at line 647 of file future.h.