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();
|
promisesToClean.clear();
|
||||||
|
|
||||||
if (emptyQueue) {
|
if (emptyQueue) {
|
||||||
while(promiseQueue.pop()) {
|
while(promiseQueue.try_dequeue(promise)) {
|
||||||
|
// We're just dequeuing
|
||||||
}
|
}
|
||||||
emptyQueue = false;
|
emptyQueue = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!promiseQueue.try_dequeue(promise)) {
|
if (!promiseQueue.try_dequeue(promise)) {
|
||||||
std::this_thread::sleep_for(1ms);
|
std::this_thread::sleep_for(0.1ms);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#include <absl/container/flat_hash_map.h>
|
#include <absl/container/flat_hash_map.h>
|
||||||
#include <absl/types/optional.h>
|
#include <absl/types/optional.h>
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
#include "moodycamel/readerwriterqueue.h"
|
#include "moodycamel/concurrentqueue.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <sndfile.hh>
|
#include <sndfile.hh>
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ private:
|
||||||
fs::path rootDirectory;
|
fs::path rootDirectory;
|
||||||
void loadingThread() noexcept;
|
void loadingThread() noexcept;
|
||||||
|
|
||||||
moodycamel::ReaderWriterQueue<FilePromisePtr> promiseQueue;
|
moodycamel::ConcurrentQueue<FilePromisePtr> promiseQueue;
|
||||||
uint32_t preloadSize { config::preloadSize };
|
uint32_t preloadSize { config::preloadSize };
|
||||||
Oversampling oversamplingFactor { config::defaultOversamplingFactor };
|
Oversampling oversamplingFactor { config::defaultOversamplingFactor };
|
||||||
// Signals
|
// Signals
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue