Thread::waitForThreadToExit (MAC)

sometimes when closing my app i get a assert at Thread::waitForThreadToExit() when calling Thread::stopThread (on MAC)
but the Current-Thread(Message-Thread) and the “thread to stop” are not the same, the reason is the thread has stopped before waitForThreadExit and getThreadID() is 0 and getCurrentThreadID() is also 0.

[code]bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const
// Doh! So how exactly do you expect this thread to wait for itself to stop??
//jassert (getThreadId() != getCurrentThreadId()); <-----------

const int sleepMsPerIteration = 5;
int count = timeOutMilliseconds / sleepMsPerIteration;

while (isThreadRunning())
    if (timeOutMilliseconds > 0 && --count < 0)
        return false;

    sleep (sleepMsPerIteration);

return true;


Ok… I guess this must be in a static destructor? Thanks, I’ll add a check for a 0 in there.