Thread::waitForThreadToExit impl

Hi Jules,

Is there a reason why the Thread::waitForThreadToExit impl on Windows do not use something like that ?

bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const throw()
{
    // Doh! So how exactly do you expect this thread to wait for itself to stop??
    jassert (getThreadId() != getCurrentThreadId());
DWORD timeout = timeOutMilliseconds;
if (timeOutMilliseconds == -1)
timeout = INFINITE;

    if (WAIT_FAILED == WaitForSingleObject(threadId, timeout))
  return false;
return true;
}

Thanks,

No particular reason, except that I prefer to write platform-independent code if possible. The only difference would be a couple of ms, which I don’t imagine should matter, when you’d typically not use this call in a time-critical way.

Is the current version causing problems for you? If you’re starting and stopping threads often, it’s probably better to use a thread pool instead.

No problem. It’s just I’ve seen this code looking for something else and was wondering.

Thanks,