class MThreadPool

Jump to documentation

Methods for creating and managing a thread pool. (OpenMaya)

public members:

static MStatus init ()
static MStatus newParallelRegion (MThreadCallbackFunc func, void* data)
static MStatus createTask (MThreadFunc func, void* data, MThreadRootTask* root)
static MStatus executeAndJoin (MThreadRootTask* root)
static void release ()

Documentation

Methods for creating and managing a thread pool. (OpenMaya)
Description

MThreadPool class. The thread pool is created with a number of threads equal to one less than the number of logical processors.

Functions

MStatus MThreadPool:: init ()

Description

Initialize thread pool creation. No threads are created by this call.

Return Value

  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MStatus MThreadPool:: newParallelRegion (MThreadCallbackFunc func, void* data)

Description

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.

Arguments

  • func pointer to function to be executed by threads
  • data data for function

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure Thread pool does not exist

MStatus MThreadPool:: createTask (MThreadFunc func, void* data, MThreadRootTask* root)

Description

Add a single task to the parallel region. The parallel region must already have been created by calling newParallelRegion.

Arguments

  • func pointer to function to be executed by threads
  • data data for function
  • root root task

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure Thread pool does not exist

MStatus MThreadPool:: executeAndJoin (MThreadRootTask* root)

Description

Run all tasks in the present parallel region to completion. This function must be called from within a function invoked by the method newParallelRegion.

Arguments

  • root task to execute

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure Thread pool does not exist

void MThreadPool:: release ()

Description

Release decreases the reference count on the thread pool. When the reference count reaches zero the thread pool is deleted.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright