|
|
@@ -156,15 +156,14 @@ 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() || getCurrentThreadId() == 0);
|
|
|
|
|
|
|
|
const int sleepMsPerIteration = 5;
|
|
|
|
int count = timeOutMilliseconds / sleepMsPerIteration;
|
|
|
|
const uint32 timeoutEnd = Time::getMillisecondCounter() + timeOutMilliseconds;
|
|
|
|
|
|
|
|
while (isThreadRunning())
|
|
|
|
{
|
|
|
|
if (timeOutMilliseconds >= 0 && --count < 0)
|
|
|
|
if (timeOutMilliseconds >= 0 && Time::getMillisecondCounter() > timeoutEnd)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
sleep (sleepMsPerIteration);
|
|
|
|
sleep (2);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|