![]() |
Vulkan SDK for Android 1.1.1
Mali Developer Center
|
Implements a simple thread pool which can be used to submit rendering work to multiple threads. It does not aim to distribute chunks of work dynamically to threads, but API users must submit work to particular worker threads. More...
#include <thread_pool.hpp>
Public Member Functions | |
void | setWorkerThreadCount (unsigned workerThreadCount) |
Sets the number of worker threads to spawn. More... | |
unsigned | getWorkerThreadCount () const |
Gets the current number of worker threads. | |
void | pushWorkToThread (unsigned threadIndex, std::function< void()> func) |
Pushes a bundle of work to a thread. More... | |
void | waitIdle () |
Waits for all worker threads to complete all work they have been assigned. | |
Implements a simple thread pool which can be used to submit rendering work to multiple threads. It does not aim to distribute chunks of work dynamically to threads, but API users must submit work to particular worker threads.
Definition at line 39 of file thread_pool.hpp.
void MaliSDK::ThreadPool::pushWorkToThread | ( | unsigned | threadIndex, |
std::function< void()> | func | ||
) |
Pushes a bundle of work to a thread.
threadIndex | The worker thread to push work to. |
func | A generic function object which will be executed by the thread. Using C++11 lambdas is the intended way to create these objects. |
Definition at line 35 of file thread_pool.cpp.
void MaliSDK::ThreadPool::setWorkerThreadCount | ( | unsigned | workerThreadCount | ) |
Sets the number of worker threads to spawn.
This call is heavyweight and should not be called more than once during initialization. To get a platform specific optimal count to use, use MaliSDK::OS::getNumberOfCpuThreads
.
workerThreadCount | The number of worker threads. |
Definition at line 28 of file thread_pool.cpp.