forked from dolphin-emu/dolphin
Revert "Android: Don't hold gameFileCache lock during updateAdditionalMetadata"
This reverts commitfb265b610d. The optimization in that commit is safe when the executor thread is writing and the GUI thread is reading, but I had failed to take into account that it's unsafe when the GUI thread is writing and the executor thread is reading. (The native UpdateAdditionalMetadata function loops through m_cached_files, which is unsafe if another thread is adding elements to m_cached_files simultaneously.) Losing out on this optimization isn't too bad, because719930bb39makes it very unlikely that both threads will want the lock at the same time.
This commit is contained in:
+14
-15
@@ -227,25 +227,24 @@ public final class GameFileCacheManager
|
||||
{
|
||||
String[] gamePaths = GameFileCache.getAllGamePaths();
|
||||
|
||||
boolean changed;
|
||||
synchronized (sGameFileCache)
|
||||
{
|
||||
changed = sGameFileCache.update(gamePaths);
|
||||
}
|
||||
if (changed)
|
||||
{
|
||||
updateGameFileArray();
|
||||
}
|
||||
boolean changed = sGameFileCache.update(gamePaths);
|
||||
if (changed)
|
||||
{
|
||||
updateGameFileArray();
|
||||
}
|
||||
|
||||
boolean additionalMetadataChanged = sGameFileCache.updateAdditionalMetadata();
|
||||
if (additionalMetadataChanged)
|
||||
{
|
||||
updateGameFileArray();
|
||||
}
|
||||
boolean additionalMetadataChanged = sGameFileCache.updateAdditionalMetadata();
|
||||
if (additionalMetadataChanged)
|
||||
{
|
||||
updateGameFileArray();
|
||||
}
|
||||
|
||||
if (changed || additionalMetadataChanged)
|
||||
{
|
||||
sGameFileCache.save();
|
||||
if (changed || additionalMetadataChanged)
|
||||
{
|
||||
sGameFileCache.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user