tmc::post_bulk_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_bulk_waitable()#

Overload for tmc::task<void>:

template<typename E, typename TaskIter, typename Task = std::iter_value_t<TaskIter>>
std::future<void> tmc::post_bulk_waitable(E &Executor, TaskIter &&Begin, size_t Count, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

Iter must be an iterator type that exposes task<void> operator*() and Iter& operator++().

Submits items in range [Begin, Begin + Count) to the executor at priority Priority. The return value is a std::future<void> that can be used to poll or blocking wait for all of the tasks to complete.

Bulk waitables only support void return; if you want to return values, preallocate a result array and capture a reference to it in your tasks.

Overload for void-returning functors:

template<typename E, typename FuncIter, typename Functor = std::iter_value_t<FuncIter>>
std::future<void> tmc::post_bulk_waitable(E &Executor, FuncIter &&Begin, size_t Count, size_t Priority = 0, size_t ThreadHint = NO_HINT)#

FuncIter must be an iterator type that exposes Functor operator*() and FuncIter& operator++(). Functor must expose void operator(). Submits items in range [Begin, Begin + Count) to the executor at priority Priority. The return value is a std::future<void> that can be used to poll or blocking wait for the result to be ready.

Bulk waitables only support void return; if you want to return values, preallocate a result array and capture a reference to it in your tasks.