Vulkan SDK for Android 1.1.1 Mali Developer Center
All Classes Functions Variables Enumerations Enumerator Pages
MaliSDK::ThreadPool Class Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ pushWorkToThread()

void MaliSDK::ThreadPool::pushWorkToThread ( unsigned  threadIndex,
std::function< void()>  func 
)

Pushes a bundle of work to a thread.

Parameters
threadIndexThe worker thread to push work to.
funcA 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.

◆ setWorkerThreadCount()

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.

Parameters
workerThreadCountThe number of worker threads.

Definition at line 28 of file thread_pool.cpp.


The documentation for this class was generated from the following files: