libcoro  1.0
Coroutine support library for C++20

◆ run()

template<typename CondVar >
template<typename Fn , typename ... Args>
requires std::invocable<Fn, Args...> auto coro::thread_pool_t< CondVar >::run ( Fn &&  fn,
Args &&...  args 
) -> future<std::invoke_result_t<Fn, Args...> >
inline

Run a function in the thread_pool.

Parameters
fnfunction / lambda function or pointer to function
argsarguments (optional)
Returns
future, which is resolved with a return value of the function. If the function doesn't return, result is future<void>. You need to co_await on result (can't be discarded).

Definition at line 81 of file thread_pool.h.