Parallel processing - is the Timer the best solution?


#1

Hello, I started other thread about updating Label text with data from getNextAudioBlock. But the thread developed to multiprocessing, that’s why I move it here for further questions :slight_smile:
But to the point. So if I have code like that:

void parentFunction(dataFromGetNextAudioBlock)
   {
       someInt++;

       if(someInt>=someOtherInt)
       {
           someInt=0;
           // And here I would like to make immedietly some childFunction, but I want make parentFunction be independent from childFunctio, I mean parentFunction is still working.
       }
   }

For that scenario shouldI just put startTimer(1); and in the timerCallBack put my childFunction? Or is there anything better to do. I would like to notice startTimer(1); gives me 0,001 second late, which is a lot of time for the processor, so it’s not “immedietaly”. That’s why I ask for any better solution.


#2

PS sorry I write from telephone, and have problems with formating the code.


#3

Is there any real reason for you to even attempt it? (And no, Timer does not make the processing parallel with regards to the GUI thread because the timers themselves run in the GUI thread.)


#4

I just want to send the data from childFunction output to the bufferToFill in the getNextAudioBlock.

But I want to be sure that next output from childFunction will be ready to use when getNextAudioBlock finish with getting data from the first output of childFunction.

That’s why I want parentFunction still working and preparing the data during getNextAudioBlock is using first output of childFunction.

Is that clear? It’s little bit tricky to explain that.