mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
fix locking bug
This commit is contained in:
parent
2290002124
commit
fc34a9ccbf
4 changed files with 43 additions and 45 deletions
|
@ -718,8 +718,7 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
||||||
* Exports the project PDOM to the specified location, rewriting locations with
|
* Exports the project PDOM to the specified location, rewriting locations with
|
||||||
* the specified location converter.
|
* the specified location converter.
|
||||||
* <br>
|
* <br>
|
||||||
* Note. this method does not acquire or release any locks. It is expected
|
* Note. This will acquire a write lock while the pdom is exported
|
||||||
* that this will be done by the caller.
|
|
||||||
* @param targetLocation a location that does not currently exist
|
* @param targetLocation a location that does not currently exist
|
||||||
* @param newConverter
|
* @param newConverter
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.index.IIndexLocationConverter;
|
||||||
import org.eclipse.cdt.core.index.export.IExportProjectProvider;
|
import org.eclipse.cdt.core.index.export.IExportProjectProvider;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.WritablePDOM;
|
import org.eclipse.cdt.internal.core.pdom.WritablePDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.ISafeRunnable;
|
import org.eclipse.core.runtime.ISafeRunnable;
|
||||||
|
@ -53,12 +52,12 @@ public class GeneratePDOM implements ISafeRunnable {
|
||||||
}
|
}
|
||||||
CCorePlugin.getIndexManager().joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
CCorePlugin.getIndexManager().joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
||||||
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
||||||
try {
|
|
||||||
PDOM pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject);
|
|
||||||
pdom.acquireWriteLock(0);
|
|
||||||
try {
|
try {
|
||||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
||||||
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter);
|
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter);
|
||||||
|
|
||||||
|
exportedPDOM.acquireWriteLock(0);
|
||||||
|
try {
|
||||||
Map exportProperties= pm.getExportProperties();
|
Map exportProperties= pm.getExportProperties();
|
||||||
if(exportProperties!=null) {
|
if(exportProperties!=null) {
|
||||||
for(Iterator i = exportProperties.entrySet().iterator(); i.hasNext(); ) {
|
for(Iterator i = exportProperties.entrySet().iterator(); i.hasNext(); ) {
|
||||||
|
@ -67,7 +66,7 @@ public class GeneratePDOM implements ISafeRunnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
pdom.releaseWriteLock(0);
|
exportedPDOM.releaseWriteLock(0);
|
||||||
}
|
}
|
||||||
} catch(InterruptedException ie) {
|
} catch(InterruptedException ie) {
|
||||||
String msg= MessageFormat.format(Messages.GeneratePDOM_GenericGenerationFailed, new Object[] {ie.getMessage()});
|
String msg= MessageFormat.format(Messages.GeneratePDOM_GenericGenerationFailed, new Object[] {ie.getMessage()});
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
worked += work;
|
worked += work;
|
||||||
int pc = totalWork<1 ? 0 : (int) ((worked*100D)/totalWork);
|
int pc = totalWork<1 ? 0 : (int) ((worked*100D)/totalWork);
|
||||||
if(shouldOutput()) {
|
if(shouldOutput()) {
|
||||||
writer.println(pc+"% "+subTask+" "+worked+" "+totalWork); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
|
writer.println(pc+"% "+subTask); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue