Skip to content

thread_pool execute

Alairion edited this page May 11, 2021 · 3 revisions

Functions

    template<typename Func, typename... Args>
(1) void execute(Func&& func, Args&&... args);
  1. Pushes a task in the thread pool, without returning a future (it saves a promise allocation). The return value of the function, if any, will be discarded. Synchronization of execute tasks can be done using user-specific operations inside the function or nes::thread_pool::wait_idle. The function will be called as-if by calling std::invoke(func, args...);. 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

None.

Preconditions

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

Exceptions

May throw a std::bad_alloc or std::system_error.

Clone this wiki locally