Skip to content

task_builder invoke

Alexy Pellegrini edited this page May 11, 2021 · 2 revisions

Functions

    template<typename Func, typename... Args>
(1) nes::task_result<std::invoke_result_t<Func, Args...>> invoke(Func&& func, Args&&... args);
  1. Pushes a task in the thread pool. The return value of the function will be sent through the returned nes::task_result. The nes::task_result can also be used to know when the task is done. The function may returns void. The arguments to the function are moved or copied by value, if a reference argument needs to be passed, it has to be wrapped using std::[c]ref, or any other wrapper.

Parameters

Name Description
func The function to be executed.
args The arguments to be passed to func.

Return value

  1. Returns a nes::task_result that will recieve the return value of std::invoke(func, args...);.

Preconditions

func must be movable, and std::invoke(func, args...); must be well-formed.

Exceptions

May throw a std::bad_alloc.

Clone this wiki locally