1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug #216996: deadlock

This commit is contained in:
Oleg Krasilnikov 2008-02-14 11:50:41 +00:00
parent 190c472757
commit 2aa55cf930

View file

@ -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) {