diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index fb120c14..7ccada70 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -108,7 +108,11 @@ sfz::FilePool::~FilePool() quitThread = true; for (unsigned i = 0; i < threadPool.size(); ++i) - workerBarrier.post(); + try { + workerBarrier.post(); + } catch (std::exception e) { + continue; + } for (auto& thread: threadPool) thread.join(); @@ -261,7 +265,7 @@ absl::optional sfz::FilePool::loadFile(const std::string& f } } -sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename) noexcept +sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename) { if (emptyPromises.empty()) { DBG("[sfizz] No empty promises left to honor the one for " << filename); @@ -322,7 +326,7 @@ void sfz::FilePool::clearingThread() } } -void sfz::FilePool::loadingThread() noexcept +void sfz::FilePool::loadingThread() { FilePromisePtr promise; while (!quitThread) { @@ -443,7 +447,7 @@ uint32_t sfz::FilePool::getPreloadSize() const noexcept return preloadSize; } -void sfz::FilePool::emptyFileLoadingQueues() noexcept +void sfz::FilePool::emptyFileLoadingQueues() { emptyQueue = true; workerBarrier.post(); diff --git a/src/sfizz/FilePool.h b/src/sfizz/FilePool.h index 187cb182..6e997c87 100644 --- a/src/sfizz/FilePool.h +++ b/src/sfizz/FilePool.h @@ -207,7 +207,7 @@ public: * @param filename the file to preload * @return FilePromisePtr a file promise */ - FilePromisePtr getFilePromise(const std::string& filename) noexcept; + FilePromisePtr getFilePromise(const std::string& filename); /** * @brief Change the preloading size. This will trigger a full * reload of all samples, so don't call it on the audio thread. @@ -240,7 +240,7 @@ public: * method on the audio thread as it will spinlock. * */ - void emptyFileLoadingQueues() noexcept; + void emptyFileLoadingQueues(); /** * @brief Wait for the background loading to finish for all promises * in the queue. @@ -249,7 +249,7 @@ public: private: Logger& logger; fs::path rootDirectory; - void loadingThread() noexcept; + void loadingThread(); void clearingThread(); void tryToClearPromises();