Maya C++ Multi Thread


#1

How can I use multi thread libraries of C++ Maya Api.
I got a “for” loop which iterates thousands of components and has processes that are not dependent between each other so I want to make them run parallel.
Is there an example for multi thread C++ Maya Api ?


#2

http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_Technical_Notes_Threading_and_Maya_API_htm

But you have to be careful which methods you use. A lot of the maya API is not threadsafe. Reading data is often not a big problem, but modifying data can be a problem.
The most secure way is to copy all data in your own data structure, manipulate it in parallel and return the result to maya in the main thread.