Merge pull request #11539 from phire/improve_workqueuethread

Various WorkQueueThread improvements
This commit is contained in:
Scott Mansell
2023-02-09 20:00:04 +13:00
committed by GitHub
7 changed files with 116 additions and 52 deletions

View File

@ -37,7 +37,7 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
connect(qApp, &QApplication::aboutToQuit, this, [this] {
m_processing_halted = true;
m_load_thread.Cancel();
m_load_thread.Shutdown(true);
});
connect(this, &QFileSystemWatcher::directoryChanged, this, &GameTracker::UpdateDirectory);
connect(this, &QFileSystemWatcher::fileChanged, this, &GameTracker::UpdateFile);
@ -55,7 +55,7 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
m_load_thread.EmplaceItem(Command{CommandType::UpdateMetadata, {}});
});
m_load_thread.Reset([this](Command command) {
m_load_thread.Reset("GameList Tracker", [this](Command command) {
switch (command.type)
{
case CommandType::LoadCache:
@ -203,7 +203,7 @@ void GameTracker::RemoveDirectory(const QString& dir)
void GameTracker::RefreshAll()
{
m_processing_halted = true;
m_load_thread.Clear();
m_load_thread.Cancel();
m_load_thread.EmplaceItem(Command{CommandType::ResumeProcessing, {}});
if (m_needs_purge)