Rewrite the loading loop to check quit flag after waiting
This commit is contained in:
parent
f25dd03db0
commit
26d63a92f0
1 changed files with 5 additions and 2 deletions
|
|
@ -377,7 +377,7 @@ void sfz::FilePool::clearingThread()
|
|||
void sfz::FilePool::loadingThread() noexcept
|
||||
{
|
||||
FilePromisePtr promise;
|
||||
while (!quitThread) {
|
||||
do {
|
||||
workerBarrier.wait();
|
||||
|
||||
if (emptyQueue) {
|
||||
|
|
@ -389,6 +389,9 @@ void sfz::FilePool::loadingThread() noexcept
|
|||
continue;
|
||||
}
|
||||
|
||||
if (quitThread)
|
||||
return;
|
||||
|
||||
if (!promiseQueue.try_pop(promise)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -418,7 +421,7 @@ void sfz::FilePool::loadingThread() noexcept
|
|||
}
|
||||
|
||||
promise.reset();
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
void sfz::FilePool::clear()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue