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:

Other libraries in the TMC ecosystem provide the following executors:

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. For example, it may be useful to create a secondary single-threaded tmc::ex_cpu to manage communication with certain systems that require all calls to come from the same thread (e.g. SDL/OpenGL). This can be created in addition to the primary multi-threaded instance of tmc::ex_cpu.

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.