MThreadPool Class Reference
#include <MThreadPool.h>
Methods for creating and managing a thread pool.
MThreadPool class. The thread pool is created with a number of threads equal to one less than the number of logical processors.
OPENMAYA_MAJOR_NAMESPACE_OPEN MStatus init |
( |
| ) |
|
|
static |
Initialize thread pool creation.
No threads are created by this call.
- Returns
- MS::kSuccess The method was successful.
- MS::kInsufficientMemory Insufficient memory to complete this method
MStatus newParallelRegion |
( |
MThreadCallbackFunc |
func, |
|
|
void * |
data |
|
) |
| |
|
static |
Creates a new parallel region.
All tasks created by createTask() will be added to this region. init() must be called to create the thread pool before calling this function.
- Parameters
-
[in] | func | pointer to function to be executed by threads |
[in] | data | data for function |
- Returns
- MS::kSuccess The method was successful.
- MS::kFailure Thread pool does not exist
MStatus createTask |
( |
MThreadFunc |
func, |
|
|
void * |
data, |
|
|
MThreadRootTask * |
root |
|
) |
| |
|
static |
Add a single task to the parallel region.
The parallel region must already have been created by calling newParallelRegion.
- Parameters
-
[in] | func | pointer to function to be executed by threads |
[in] | data | data for function |
[in] | root | root task |
- Returns
- MS::kSuccess The method was successful.
- MS::kFailure Thread pool does not exist
MStatus executeAndJoin |
( |
MThreadRootTask * |
root | ) |
|
|
static |
Run all tasks in the present parallel region to completion.
This function must be called from within a function invoked by the method newParallelRegion.
- Parameters
-
- Returns
- MS::kSuccess The method was successful.
- MS::kFailure Thread pool does not exist
Release decreases the reference count on the thread pool.
When the reference count reaches zero the thread pool is deleted.
const char * className |
( |
| ) |
|
|
static |
Returns the name of this class.
- Returns
- The name of this class.
The documentation for this class was generated from the following files:
- MThreadPool.h
- MThreadPool.cpp