Name

OfxMultiThreadSuiteV1::multiThread — Function to spawn SMP threads

Synopsis

#include "ofxMultiThread.h" 
OfxStatus(*multiThread)(OfxThreadFunctionV1func,
 unsigned intnThreads,
 void *customArg);
 

Arguments

  • func - The function to call in each thread.
  • nThreads - The number of threads to launch
  • customArg - The paramter to pass to customArg of func in each thread.

Description

This function will spawn nThreads separate threads of computation (typically one per CPU) to allow something to perform symmetric multi processing. Each thread will call 'func' passing in the index of the thread and the number of threads actually launched.

multiThread will not return until all the spawned threads have returned. It is up to the host how it waits for all the threads to return (busy wait, blocking, whatever).

nThreads can be more than the value returned by multiThreadNumCPUs, however the threads will be limitted to the number of CPUs returned by multiThreadNumCPUs.

This function cannot be called recursively.

Returns