Thread priority question

I just found out what the problem is (took long time to do so…): it always happens when a Thread exits from its run() method - so at the end of the run() method I get a click in the sound. The Thread I run can be as simple as this:

MyThread::run()
{
Thread::sleep(2000);
}

so when I press some button and the call myThread->startThread(), I get some click after 2 seconds.

As a side note (if some of you have the same problem) :

  • This also happens with the Win32 function CreateThread(), so it’s not a JUCE problem
  • It only happens when starting you .EXE from within Visual Studio (using the Start button), so best is always to start your .EXE directly, and not from within Visual Studio for some heavy testing purposes :slight_smile:

In Visual Studio, isn’t that the debugger having to pause all threads for debuggery purposages? I think even with a non-debug build Studio might dig in and be in control of threads. Fuck knows.