diff options
author | James Blackburn | 2010-04-22 15:43:21 +0000 |
---|---|---|
committer | James Blackburn | 2010-04-22 15:43:21 +0000 |
commit | 077917c1f5c4c5626193059d944b30ccf0482c02 (patch) | |
tree | d339670b0cf4fd42b7cd4fdbb5cb6c5824e168c0 | |
parent | 63dc719a21849fc9f6dfb34dd5799cf0fa438eb7 (diff) | |
download | org.eclipse.cdt-077917c1f5c4c5626193059d944b30ccf0482c02.tar.gz org.eclipse.cdt-077917c1f5c4c5626193059d944b30ccf0482c02.tar.xz org.eclipse.cdt-077917c1f5c4c5626193059d944b30ccf0482c02.zip |
Bug 310007 back-out changes - tests aren't happy
2 files changed, 9 insertions, 16 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java index 3d32e38b961..ce6e4b670fb 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java @@ -443,9 +443,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { monitor = new NullProgressMonitor(); // Should the rule be scheduled, or run immediately - // Bug 310007 - Always unsafe to modify resources while data structure lock is held - boolean scheduleRule = true; -// boolean scheduleRule = ResourcesPlugin.getWorkspace().isTreeLocked(); + boolean scheduleRule = ResourcesPlugin.getWorkspace().isTreeLocked(); // Check whether current job contains rule 'rule' // If not, we must schedule another job to execute the runnable diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/xml/XmlProjectDescriptionStorage.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/xml/XmlProjectDescriptionStorage.java index d8316f7d06f..1772afea4e6 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/xml/XmlProjectDescriptionStorage.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/xml/XmlProjectDescriptionStorage.java @@ -48,9 +48,9 @@ import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager; import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager; import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory; import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType; -import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType.CProjectDescriptionStorageTypeProxy; import org.eclipse.cdt.internal.core.settings.model.SettingsContext; import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages; +import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType.CProjectDescriptionStorageTypeProxy; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -61,7 +61,6 @@ import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -121,8 +120,6 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto super(type, project, version); } - private int desSerialTotalCount; - private volatile int desSerialCurrent; /** * The workspace runnable that actually goes about serializing the project description @@ -130,22 +127,20 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto private class DesSerializationRunnable implements IWorkspaceRunnable { private final ICProjectDescription fDes; private final ICStorageElement fElement; - private final int serializingNumber; public DesSerializationRunnable(ICProjectDescription des, ICStorageElement el) { fDes = des; fElement = el; - serializingNumber = desSerialTotalCount++; } public void run(IProgressMonitor monitor) throws CoreException { - // Asserting that the platform job API stands by its committment to run jobs - // with conflicting scheduling rules in strict order -- so the project configuration - // at the end of a batch of changes is consistent. - Assert.isTrue(serializingNumber == desSerialCurrent); - desSerialCurrent++; - projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement); - ((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes); + try { + serializingLock.acquire(); + projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement); + ((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes); + } finally { + serializingLock.release(); + } } } |