Added the concurrent queue to the filepool
This commit is contained in:
parent
48a07c23fe
commit
e33ce85a6a
2 changed files with 5 additions and 5 deletions
|
|
@ -189,15 +189,15 @@ void sfz::FilePool::loadingThread() noexcept
|
|||
promisesToClean.clear();
|
||||
|
||||
if (emptyQueue) {
|
||||
while(promiseQueue.pop()) {
|
||||
|
||||
while(promiseQueue.try_dequeue(promise)) {
|
||||
// We're just dequeuing
|
||||
}
|
||||
emptyQueue = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!promiseQueue.try_dequeue(promise)) {
|
||||
std::this_thread::sleep_for(1ms);
|
||||
std::this_thread::sleep_for(0.1ms);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include <absl/container/flat_hash_map.h>
|
||||
#include <absl/types/optional.h>
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "moodycamel/readerwriterqueue.h"
|
||||
#include "moodycamel/concurrentqueue.h"
|
||||
#include <thread>
|
||||
#include <sndfile.hh>
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ private:
|
|||
fs::path rootDirectory;
|
||||
void loadingThread() noexcept;
|
||||
|
||||
moodycamel::ReaderWriterQueue<FilePromisePtr> promiseQueue;
|
||||
moodycamel::ConcurrentQueue<FilePromisePtr> promiseQueue;
|
||||
uint32_t preloadSize { config::preloadSize };
|
||||
Oversampling oversamplingFactor { config::defaultOversamplingFactor };
|
||||
// Signals
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue