tmc::post_waitable()

The ThreadHint parameter can be used to request, but not guarantee, that a task executes on a particular thread. The value passed should be the integer index in range [0..ThreadCount) of the thread in that executor. You can retrieve the current thread index using tmc::current_thread_index().

tmc::post_waitable()#

Overloads for tmc::task:

template<typename E>
std::future<void> tmc::post_waitable(E &Executor, task<void> &&Task, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

Submits Task to Executor for execution at priority Priority. The return value is a std::future<void> that can be used to poll or blocking wait for the task to complete.

template<typename E, typename Result>
std::future<Result> tmc::post_waitable(E &Executor, task<Result> &&Task, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

Submits Task to Executor for execution at priority Priority. The return value is a std::future<Result> that can be used to poll or blocking wait for the result to be ready.

Overloads for functors:

template<typename E, typename FuncVoid>
std::future<void> tmc::post_waitable(E &Executor, FuncVoid &&Func, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

Given a functor that returns void, this submits Functor to Executor for execution at priority Priority. The return value is a std::future<void> that can be used to poll or blocking wait for the task to complete.

template<typename E, typename FuncResult, typename Result = std::invoke_result_t<FuncResult>>
std::future<Result> tmc::post_waitable(E &Executor, FuncResult &&Func, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

Given a functor that returns a value Result, this submits Functor to Executor for execution at priority Priority. The return value is a std::future<Result> that can be used to poll or blocking wait for the result to be ready.