Defined in carb/tasking/ThreadPoolUtils.h

class ThreadPoolWrapper

Helper class for using IThreadPool API.

Public Functions

inline ThreadPoolWrapper(IThreadPool *poolInterface, size_t workerCount = 0)


  • poolInterface – The acquired IThreadPool interface.

  • workerCount – (optional) The number of worker threads to create. If 0 (default) is specified, the value returned from IThreadPool::getDefaultWorkerCount() is used.

inline size_t getWorkerCount() const

Returns the number of worker threads in the thread pool.


The number of worker threads.

template<class Callable, class ...Args>
inline auto enqueueJob(Callable &&task, Args&&... args)

Enqueues a Callable to run on a worker thread.

  • task – The callable object. May be a lambda, [member] function, functor, etc.

  • args – Optional std::bind-style arguments to pass to the callable object.


A std::future based on the return-type of the callable object. If enqueuing failed, valid() on the returned future will be false.

inline size_t getCurrentlyRunningJobCount() const

Returns the number of jobs currently enqueued or executing in the ThreadPool.

enqueueJob() increments this value and the value is decremented as jobs finish.


This value changes by other threads and cannot be read atomically.


The number of jobs currently executing in the ThreadPool.

inline void waitUntilFinished() const

Blocks the calling thread until all enqueued tasks have completed.

inline bool isValid() const

Returns true if the underlying ThreadPool is valid.


true if the underlying ThreadPool is valid; false otherwise.

inline ~ThreadPoolWrapper()