Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorJeff Johnston2018-10-12 13:09:43 -0400
committerJeff Johnston2018-10-12 13:14:52 -0400
commitc9eee479b4c714509e1b006063a4cbdaeed9cdc4 (patch)
tree2b9a0c0242765a2f0ba22903b30007663361960a /launch
parentefbda46cba9dbb17eaebf74013021ea1ab8114fb (diff)
downloadorg.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.tar.gz
org.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.tar.xz
org.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.zip
Bug 540085 - Deadlock in ToolChainManager init
- modify ContainerGCCToolChainProvider.init so that the CBuildConfigurationManager.recheckConfigs() call is done within a separate job so the init() call will return without causing deadlock - do the same for ContainerTargetTypeProvider - modify CBuildConfigurationManager initProviders() method to be synchronized Change-Id: I4ca9371fb340887233872b6d315621a24450fb2b
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java25
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java26
2 files changed, 38 insertions, 13 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
index 297359f676..8375228535 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
@@ -123,12 +123,25 @@ public class ContainerTargetTypeProvider
DockerConnectionManager.getInstance()
.addConnectionManagerListener(this);
- // call the recheckConfigs method in case any disabled targets are now
- // ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
- ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;
- manager.recheckConfigs();
+ // re-check configs in case an enabled Connection has made old configs
+ // valid again do this in a separate job to prevent a possible
+ // deadlock trying to get the lock on the CBuildConfigurationManager
+ // "configs" map (Bug 540085)
+ Job checkConfigs = new Job("Check configs") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // call the recheckConfigs method in case any disabled targets
+ // are now
+ // ok
+ ICBuildConfigurationManager mgr = CCorePlugin
+ .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
+ cbuildmanager.recheckConfigs();
+ return Status.OK_STATUS;
+ }
+ };
+ checkConfigs.setUser(true);
+ checkConfigs.schedule();
try {
launchbarManager.setActiveLaunchTarget(defaultTarget);
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
index defb52a92a..9bcad227db 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
@@ -98,13 +98,25 @@ public class ContainerGCCToolChainProvider
DockerConnectionManager.getInstance()
.addConnectionManagerListener(this);
- // call the recheckConfigs method in case any disabled targets are now
- // ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
- ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
- cbuildmanager.recheckConfigs();
-
+ // re-check configs in case an enabled Connection has made old configs
+ // valid again do this in a separate job to prevent a possible
+ // deadlock trying to get the lock on the CBuildConfigurationManager
+ // "configs" map (Bug 540085)
+ Job checkConfigs = new Job("Check configs") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // call the recheckConfigs method in case any disabled targets
+ // are now
+ // ok
+ ICBuildConfigurationManager mgr = CCorePlugin
+ .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
+ cbuildmanager.recheckConfigs();
+ return Status.OK_STATUS;
+ }
+ };
+ checkConfigs.setUser(true);
+ checkConfigs.schedule();
}
@Override

Back to the top