ThreadPoolΒΆ
Inherited: Object
DescriptionΒΆ
Public MethodsΒΆ
uint32_t |
maxThreads () const |
void |
setMaxThreads (uint32_t number) |
void |
start (Runable * runnable) |
bool |
waitForDone (int32_t msecs = -1) |
Static MethodsΒΆ
uint32_t |
Methods DescriptionΒΆ
uint32_t ThreadPool::maxThreads () const
Returns the max number of threads allocated to work.
See also setMaxThreads().
uint32_t ThreadPool::optimalThreadCount ()
Returns the optimal thread count for the current system. This value is based on the number of CPU cores.
void ThreadPool::setMaxThreads (uint32_t number)
Sets the max number of threads allocated to work.
See also maxThreads().
void ThreadPool::start (Runable * runnable)
Adds a runnable to run queue. In case of any free worker available executes task immediately.
bool ThreadPool::waitForDone (int32_t msecs = -1)
Waits up to msecs milliseconds for all threads to exit and removes all threads from the thread pool. Returns true if all threads were removed; otherwise it returns false. If msecs is -1 (the default), the timeout is ignored (waits for the last thread to exit).