Executors

Executors#

Executors accept work into a queue and run it by calling operator()() on the provided work item. The following executors are provided by the core library of TooManyCooks:

tmc::ex_cpu

general-purpose multi-threaded executor

tmc::ex_cpu_st

general-purpose single-threaded executor

tmc::ex_braid

serializing executor

tmc::ex_any

type-erased wrapper that can represent any TMC executor

Other libraries in the TMC ecosystem provide the following executors:

tmc::ex_asio

I/O executor built on the Asio library

Each executor instance manages a completely independent set of resources / threads, and you can create multiple of the same kind of executor if you wish.

Work can be submitted for execution to any executor using the tmc::post() / tmc::post_bulk() functions.

From within a task that is already running on an executor, tmc::spawn() / tmc::spawn_many() can be used to submit work to the same executor.

For more information on how to integrate your own executor with TMC, see Integrating External Executors.