aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Amland <thomas.amland@gmail.com>2016-10-30 13:51:31 +0100
committerThomas Amland <thomas.amland@gmail.com>2016-11-13 15:23:03 +0100
commit782caa0c257213ad6c87b0d1ceb114d1878b3e8e (patch)
tree586025a3422f366e35db3f548104b3e59c9be51f
parente5753bfbbf147fd31f59490cc20c9a274656e36e (diff)
workaround: run jobs that blocks waiting for other jobs at priority dedicated to prevent deadlock
-rw-r--r--xbmc/Application.cpp10
-rw-r--r--xbmc/addons/AddonInstaller.cpp4
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<bool> 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;