From 782caa0c257213ad6c87b0d1ceb114d1878b3e8e Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 30 Oct 2016 13:51:31 +0100 Subject: workaround: run jobs that blocks waiting for other jobs at priority dedicated to prevent deadlock --- xbmc/Application.cpp | 10 +++++----- xbmc/addons/AddonInstaller.cpp | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 13012af0d9..12b568e1be 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1159,11 +1159,11 @@ bool CApplication::Initialize() event.Reset(); std::atomic isMigratingAddons(false); CJobManager::GetInstance().Submit([&event, &incompatibleAddons, &isMigratingAddons]() { - incompatibleAddons = CAddonSystemSettings::GetInstance().MigrateAddons([&isMigratingAddons]() { - isMigratingAddons = true; - }); - event.Set(); - }); + incompatibleAddons = CAddonSystemSettings::GetInstance().MigrateAddons([&isMigratingAddons]() { + isMigratingAddons = true; + }); + event.Set(); + }, CJob::PRIORITY_DEDICATED); localizedStr = g_localizeStrings.Get(24151); iDots = 1; while (!event.WaitMSec(1000)) diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index d4be4b3d0a..d0cfad8bf9 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -243,7 +243,9 @@ bool CAddonInstaller::DoInstall(const AddonPtr &addon, const RepositoryPtr& repo CAddonInstallJob* installJob = new CAddonInstallJob(addon, repo, hash); if (background) { - unsigned int jobID = CJobManager::GetInstance().AddJob(installJob, this); + // Workaround: because CAddonInstallJob is blocking waiting for other jobs, it needs to be run + // with priority dedicated. + unsigned int jobID = CJobManager::GetInstance().AddJob(installJob, this, CJob::PRIORITY_DEDICATED); m_downloadJobs.insert(make_pair(addon->ID(), CDownloadJob(jobID))); m_idle.Reset(); return true; -- cgit v1.2.3