Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2009-11-26 01:24:06 +0000
committerChris Recoskie2009-11-26 01:24:06 +0000
commitfb47ae068dd2a4c10741e26de658e0874bb821fd (patch)
treee715736fb7a3a66be42d1d483e5cf4774f88ec7f
parent2b595ff437daeb7fb3568f62ba7fc12b2602f3c6 (diff)
downloadorg.eclipse.cdt-fb47ae068dd2a4c10741e26de658e0874bb821fd.tar.gz
org.eclipse.cdt-fb47ae068dd2a4c10741e26de658e0874bb821fd.tar.xz
org.eclipse.cdt-fb47ae068dd2a4c10741e26de658e0874bb821fd.zip
further fixes for Bug 295117 - deadlock in CfgDiscoveredPathManager.getDiscoveredInfo()
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java7
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java15
3 files changed, 22 insertions, 5 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
index 744659519f6..b1ccf45f020 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Intel Corporation and others.
+ * Copyright (c) 2007, 2009 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.build.internal.core.scannerconfig;
@@ -194,12 +195,12 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
PathInfo info = getCachedPathInfo(cInfo);
if (info == null) {
- // Change synchronization to be a workspace lock on the project. Otherwise
+ // Change synchronization to be a lock on the workspace root. Otherwise
// if the project description is queried from a project change listener, it will deadlock
GetDiscoveredInfoRunnable runnable = new GetDiscoveredInfoRunnable(cInfo, project, context);
- ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null);
+ ResourcesPlugin.getWorkspace().run(runnable, ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, null);
info = runnable.getPathInfo();
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index 5a6c8c0a256..ba0a91f022d 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -51,8 +51,12 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.dom.rewrite.astwriter;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;x-internal:=true,
org.eclipse.cdt.internal.core.dom.rewrite.commenthandler;x-internal:=true,
+ org.eclipse.cdt.internal.core.dom.rewrite.util;x-internal:=true,
org.eclipse.cdt.internal.core.envvar;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.index;x-friends:="org.eclipse.cdt.ui",
+ org.eclipse.cdt.internal.core.index.composite;x-internal:=true,
+ org.eclipse.cdt.internal.core.index.composite.c;x-internal:=true,
+ org.eclipse.cdt.internal.core.index.composite.cpp;x-internal:=true,
org.eclipse.cdt.internal.core.index.provider;x-internal:=true,
org.eclipse.cdt.internal.core.indexer;x-internal:=true,
org.eclipse.cdt.internal.core.language;x-friends:="org.eclipse.cdt.ui",
@@ -70,6 +74,7 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.pdom.dom.cpp;x-internal:=true,
org.eclipse.cdt.internal.core.pdom.export;x-internal:=true,
org.eclipse.cdt.internal.core.pdom.indexer;x-friends:="org.eclipse.cdt.ui",
+ org.eclipse.cdt.internal.core.settings.model;x-internal:=true,
org.eclipse.cdt.internal.core.util;x-internal:=true,
org.eclipse.cdt.internal.errorparsers;x-internal:=true,
org.eclipse.cdt.internal.formatter;x-internal:=true,
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
index fedc3e23b3c..7a55b8425ae 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 QNX Software Systems and others.
+ * Copyright (c) 2005, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
* Sergey Prigogin (Google)
* Tim Kelly (Nokia)
* Anna Dushistova (MontaVista)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@@ -719,7 +720,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
// in case a team provider does not implement a rule-factory, the
// platform makes a pessimistic choice and locks the workspace. We
// have to check for that.
- ISchedulingRule rule= project.getWorkspace().getRuleFactory().refreshRule(project.getFolder(SETTINGS_FOLDER_NAME));
+
+ // Unfortunately, updating the project description, which can be
+ // caused by accessing the scanner info if it's not already created,
+ // requires a workspace lock. We thus have to lock on the workspace root
+ // as well, because it is illegal to lock an object higher up in the
+ // resource hierarchy (i.e. the root) when you only hold the lock for an object
+ // lower in the hierarchy (the project in our case). Locking
+ // the root from the outset will prevent this from happening, although it means
+ // that the indexer will have to wait if someone is modifying the workspace,
+ // even if that modification is not to our project.
+ ISchedulingRule rule= project.getWorkspace().getRoot();
if (project.contains(rule)) {
rule= MultiRule.combine(project, INIT_INDEXER_SCHEDULING_RULE);
}

Back to the top