diff options
| author | JosJuice <josjuice@gmail.com> | 2021-08-24 15:07:15 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-08-24 15:35:39 +0200 |
| commit | fb265b610de08df5509e56beeb3dbff68f7d4396 (patch) | |
| tree | fd316440852ab3df13acb4f6e38c87d978490e78 /Source/Core/UICommon/GameFileCache.cpp | |
| parent | bba33c7cede68259c7f2b05e9964960d9e2570e4 (diff) | |
Android: Don't hold gameFileCache lock during updateAdditionalMetadata
It seems like we spend a lot of the game list scanning time in
updateAdditionalMetadata, which I suppose makes sense considering
how many different files that function attempts to open.
With the addition of just one little atomic operation, we can make
it safe to call updateAdditionalMetadata without holding a lock.
Diffstat (limited to 'Source/Core/UICommon/GameFileCache.cpp')
| -rw-r--r-- | Source/Core/UICommon/GameFileCache.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp index a0bf0caf42..30bbca924b 100644 --- a/Source/Core/UICommon/GameFileCache.cpp +++ b/Source/Core/UICommon/GameFileCache.cpp @@ -4,6 +4,7 @@ #include "UICommon/GameFileCache.h" #include <algorithm> +#include <atomic> #include <cstddef> #include <functional> #include <list> @@ -202,7 +203,7 @@ bool GameFileCache::UpdateAdditionalMetadata(std::shared_ptr<GameFile>* game_fil if (custom_cover_changed) copy->CustomCoverCommit(); - *game_file = std::move(copy); + std::atomic_store(game_file, std::move(copy)); return true; } |
