Add back the noexcepts
This commit is contained in:
parent
b494835fdd
commit
7c07df4f66
2 changed files with 17 additions and 9 deletions
|
|
@ -262,7 +262,7 @@ absl::optional<sfz::FileDataHandle> sfz::FilePool::loadFile(const std::string& f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename)
|
sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename) noexcept
|
||||||
{
|
{
|
||||||
if (emptyPromises.empty()) {
|
if (emptyPromises.empty()) {
|
||||||
DBG("[sfizz] No empty promises left to honor the one for " << filename);
|
DBG("[sfizz] No empty promises left to honor the one for " << filename);
|
||||||
|
|
@ -286,7 +286,11 @@ sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename)
|
||||||
DBG("[sfizz] Could not enqueue the promise for " << filename << " (queue capacity " << promiseQueue.capacity() << ")");
|
DBG("[sfizz] Could not enqueue the promise for " << filename << " (queue capacity " << promiseQueue.capacity() << ")");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
workerBarrier.post();
|
|
||||||
|
std::error_code ec;
|
||||||
|
workerBarrier.post(ec);
|
||||||
|
ASSERT(!ec);
|
||||||
|
|
||||||
emptyPromises.pop_back();
|
emptyPromises.pop_back();
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
|
|
@ -323,7 +327,7 @@ void sfz::FilePool::clearingThread()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfz::FilePool::loadingThread()
|
void sfz::FilePool::loadingThread() noexcept
|
||||||
{
|
{
|
||||||
FilePromisePtr promise;
|
FilePromisePtr promise;
|
||||||
while (!quitThread) {
|
while (!quitThread) {
|
||||||
|
|
@ -336,7 +340,9 @@ void sfz::FilePool::loadingThread()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
workerBarrier.wait();
|
std::error_code ec;
|
||||||
|
workerBarrier.wait(ec);
|
||||||
|
ASSERT(!ec);
|
||||||
|
|
||||||
if (!promiseQueue.try_pop(promise)) {
|
if (!promiseQueue.try_pop(promise)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -444,10 +450,12 @@ uint32_t sfz::FilePool::getPreloadSize() const noexcept
|
||||||
return preloadSize;
|
return preloadSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfz::FilePool::emptyFileLoadingQueues()
|
void sfz::FilePool::emptyFileLoadingQueues() noexcept
|
||||||
{
|
{
|
||||||
emptyQueue = true;
|
emptyQueue = true;
|
||||||
workerBarrier.post();
|
std::error_code ec;
|
||||||
|
workerBarrier.post(ec);
|
||||||
|
ASSERT(!ec);
|
||||||
|
|
||||||
while (emptyQueue)
|
while (emptyQueue)
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ public:
|
||||||
* @param filename the file to preload
|
* @param filename the file to preload
|
||||||
* @return FilePromisePtr a file promise
|
* @return FilePromisePtr a file promise
|
||||||
*/
|
*/
|
||||||
FilePromisePtr getFilePromise(const std::string& filename);
|
FilePromisePtr getFilePromise(const std::string& filename) noexcept;
|
||||||
/**
|
/**
|
||||||
* @brief Change the preloading size. This will trigger a full
|
* @brief Change the preloading size. This will trigger a full
|
||||||
* reload of all samples, so don't call it on the audio thread.
|
* 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.
|
* method on the audio thread as it will spinlock.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void emptyFileLoadingQueues();
|
void emptyFileLoadingQueues() noexcept;
|
||||||
/**
|
/**
|
||||||
* @brief Wait for the background loading to finish for all promises
|
* @brief Wait for the background loading to finish for all promises
|
||||||
* in the queue.
|
* in the queue.
|
||||||
|
|
@ -249,7 +249,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Logger& logger;
|
Logger& logger;
|
||||||
fs::path rootDirectory;
|
fs::path rootDirectory;
|
||||||
void loadingThread();
|
void loadingThread() noexcept;
|
||||||
void clearingThread();
|
void clearingThread();
|
||||||
void tryToClearPromises();
|
void tryToClearPromises();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue