diff options
author | Liam <byteslice@airmail.cc> | 2023-06-23 04:05:08 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-06-23 06:57:24 +0200 |
commit | 1dd166f76653bee7f7c2a0a89929ee9232680536 (patch) | |
tree | 39dfca9d26a35b8567cf40fc88cdec508d9be91f /src/core/file_sys/vfs_real.h | |
parent | Merge pull request #10457 from Kelebek1/optimise (diff) | |
download | yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar.gz yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar.bz2 yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar.lz yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar.xz yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.tar.zst yuzu-1dd166f76653bee7f7c2a0a89929ee9232680536.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/file_sys/vfs_real.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h index 67f4c4422..26ea7df62 100644 --- a/src/core/file_sys/vfs_real.h +++ b/src/core/file_sys/vfs_real.h @@ -4,6 +4,7 @@ #pragma once #include <map> +#include <mutex> #include <optional> #include <string_view> #include "common/intrusive_list.h" @@ -48,22 +49,24 @@ private: std::map<std::string, std::weak_ptr<VfsFile>, std::less<>> cache; ReferenceListType open_references; ReferenceListType closed_references; + std::mutex list_lock; size_t num_open_files{}; private: friend class RealVfsFile; - void RefreshReference(const std::string& path, Mode perms, FileReference& reference); + std::unique_lock<std::mutex> RefreshReference(const std::string& path, Mode perms, + FileReference& reference); void DropReference(std::unique_ptr<FileReference>&& reference); - void EvictSingleReference(); - -private: - void InsertReferenceIntoList(FileReference& reference); - void RemoveReferenceFromList(FileReference& reference); private: friend class RealVfsDirectory; VirtualFile OpenFileFromEntry(std::string_view path, std::optional<u64> size, Mode perms = Mode::Read); + +private: + void EvictSingleReferenceLocked(); + void InsertReferenceIntoListLocked(FileReference& reference); + void RemoveReferenceFromListLocked(FileReference& reference); }; // An implementation of VfsFile that represents a file on the user's computer. |