Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DolphinQt2: Don't use a mutex in GameFileCache #6284

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Jan 4, 2018

GameTracker's usage of GameFileCache is thread-safe even without using a mutex. All of its access to GameFileCache happens on the thread m_load_thread, except for the call to GameFileCache::Load, which finishes before m_load_thread starts executing.

@@ -26,5 +26,4 @@ class GameFileCache
QString m_path;

QMap<QString, GameFile> m_gamefiles;
std::mutex m_mutex;

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -74,14 +66,10 @@ void GameFileCache::Save()

void GameFileCache::Update(const GameFile& gamefile)
{
std::lock_guard<std::mutex> guard(m_mutex);

m_gamefiles[gamefile.GetFilePath()] = gamefile;
}

QList<QString> GameFileCache::GetCached()

This comment was marked as off-topic.

@@ -22,22 +22,16 @@ GameFileCache::GameFileCache()

bool GameFileCache::IsCached(const QString& path)

This comment was marked as off-topic.

GameTracker's usage of GameFileCache is thread-safe even without
using a mutex. All of its access to GameFileCache happens on the
thread m_load_thread, except for the call to GameFileCache::Load,
which finishes before m_load_thread starts executing.
@leoetlino leoetlino merged commit e31f8f8 into dolphin-emu:master Jan 4, 2018
@JosJuice JosJuice deleted the qt-gamefilecache-mutex branch January 4, 2018 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants