Use the spinlock mutex in FilePool
This commit is contained in:
parent
4c1de84c0f
commit
5928218b62
2 changed files with 4 additions and 3 deletions
|
|
@ -361,7 +361,7 @@ void sfz::FilePool::setPreloadSize(uint32_t preloadSize) noexcept
|
|||
|
||||
void sfz::FilePool::tryToClearPromises()
|
||||
{
|
||||
const std::lock_guard<std::mutex> promiseLock { promiseGuard };
|
||||
const std::lock_guard<SpinMutex> promiseLock { promiseGuard };
|
||||
|
||||
for (auto& promise: promisesToClear) {
|
||||
if (promise->dataStatus != FilePromise::DataStatus::Wait)
|
||||
|
|
@ -442,7 +442,7 @@ void sfz::FilePool::clear()
|
|||
|
||||
void sfz::FilePool::cleanupPromises() noexcept
|
||||
{
|
||||
const std::unique_lock<std::mutex> lock { promiseGuard, std::try_to_lock };
|
||||
const std::unique_lock<SpinMutex> lock { promiseGuard, std::try_to_lock };
|
||||
if (!lock.owns_lock())
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "AudioSpan.h"
|
||||
#include "FileId.h"
|
||||
#include "SIMDHelpers.h"
|
||||
#include "utility/SpinMutex.h"
|
||||
#include "ghc/fs_std.hpp"
|
||||
#include <absl/container/flat_hash_map.h>
|
||||
#include <absl/types/optional.h>
|
||||
|
|
@ -288,7 +289,7 @@ private:
|
|||
std::vector<FilePromisePtr> emptyPromises;
|
||||
std::vector<FilePromisePtr> temporaryFilePromises;
|
||||
std::vector<FilePromisePtr> promisesToClear;
|
||||
std::mutex promiseGuard;
|
||||
SpinMutex promiseGuard;
|
||||
|
||||
// Preloaded data
|
||||
absl::flat_hash_map<FileId, FileDataHandle> preloadedFiles;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue