Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Krasilnikov2008-02-14 06:56:38 -0500
committerOleg Krasilnikov2008-02-14 06:56:38 -0500
commit864125184f9578cc8f209037449206f18e59cbdc (patch)
tree8562db43773bcdc8b2e5074203ceea5827be9814
parentff837afb2e7a4620e685ca0e94f07ad50af56833 (diff)
downloadorg.eclipse.cdt-864125184f9578cc8f209037449206f18e59cbdc.tar.gz
org.eclipse.cdt-864125184f9578cc8f209037449206f18e59cbdc.tar.xz
org.eclipse.cdt-864125184f9578cc8f209037449206f18e59cbdc.zip
Bug #216996 : deadlock
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java
index 5abbf64de1..e2f77ca814 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptorManager.java
@@ -52,6 +52,8 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
import org.w3c.dom.Element;
public class CConfigBasedDescriptorManager implements ICDescriptorManager {
@@ -194,11 +196,21 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
return getDescriptor(project, true);
}
+ private ILock fInstanceLock = Job.getJobManager().newLock();
+
public ICDescriptor getDescriptor(IProject project, boolean create)
throws CoreException {
- synchronized (CProjectDescriptionManager.getInstance()) {
+ if (create) {
+ synchronized (CProjectDescriptionManager.getInstance()) {
+ try {
+ fInstanceLock.acquire();
+ return findDescriptor(project, create);
+ } finally {
+ fInstanceLock.release();
+ }
+ }
+ } else // no need to synchronize in this case.
return findDescriptor(project, create);
- }
}
public void addDescriptorListener(ICDescriptorListener listener) {

Back to the top