ThreadPool class
#include <nCine/Threading/ThreadPool.h>
Thread pool.
Maintains a fixed set of worker threads that pull queued IThreadCommand instances off a shared queue and execute them. Implements the IThreadPool interface and is non-copyable.
Base classes
- class IThreadPool
- Thread pool interface.
Constructors, destructors, conversion operators
- ThreadPool()
- Creates a thread pool with as many worker threads as available processors.
-
ThreadPool(std::
size_t numThreads) explicit - Creates a thread pool with the given number of worker threads.
- ~ThreadPool() override
Public functions
-
void EnqueueCommand(std::
unique_ptr<IThreadCommand>&& threadCommand) override - Enqueues a command to be executed by a worker thread.