Do I need one seperate file for each threaded function and what is the max number of threads?

Or is it possible to have several threaded functions in one seperate thread?
Like:

thread::threadedFunction1(){

}

and:

thread::threadedFunction2(){

}

and call only the one that is needed?
And I guess, the max number of threads is limited by the number of cpu cores?

Hey @Jona, when I’ve used ofThread in the past, I’ve followed the design of the threadExample, where a new class inherits from ofThread, and has only 1 threadedFunction(). The class inherits (and then redefines) its threadedFunction() from ofThread. But each threadedFunction() can call several other functions in the class. Also, the threadChannelExample is definitely worth looking at too. And there are some other was to use parallel computing with oF, either with shaders on the gpu, or with external libraries like TBB (or GCD on macOS).

1 Like

@TimChi, thanks for the explanations. That helps and I will have a closer look into the examples.