mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Fix related to 173379, acquiring write lock in indexer task.
This commit is contained in:
parent
4a12afdf17
commit
d09a32444e
3 changed files with 5 additions and 5 deletions
|
@ -171,14 +171,14 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
project.accept(new TranslationUnitCollector(sources, headers, allFiles));
|
project.accept(new TranslationUnitCollector(sources, headers, allFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeTU(IWritableIndex index, ITranslationUnit tu) throws CoreException, InterruptedException {
|
protected void removeTU(IWritableIndex index, ITranslationUnit tu, int readlocks) throws CoreException, InterruptedException {
|
||||||
index.acquireWriteLock(0);
|
index.acquireWriteLock(readlocks);
|
||||||
try {
|
try {
|
||||||
IIndexFragmentFile file = (IIndexFragmentFile) index.getFile(getIndexFileLocation(tu));
|
IIndexFragmentFile file = (IIndexFragmentFile) index.getFile(getIndexFileLocation(tu));
|
||||||
if (file != null)
|
if (file != null)
|
||||||
index.clearFile(file);
|
index.clearFile(file);
|
||||||
} finally {
|
} finally {
|
||||||
index.releaseWriteLock(0);
|
index.releaseWriteLock(readlocks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class PDOMFastHandleDelta extends PDOMFastIndexerJob {
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||||
removeTU(index, tu);
|
removeTU(index, tu, 1);
|
||||||
if (tu.isSourceUnit()) {
|
if (tu.isSourceUnit()) {
|
||||||
fCompletedSources++;
|
fCompletedSources++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class PDOMFullHandleDelta extends PDOMFullIndexerJob {
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
ITranslationUnit tu = (ITranslationUnit)i.next();
|
ITranslationUnit tu = (ITranslationUnit)i.next();
|
||||||
removeTU(index, tu);
|
removeTU(index, tu, 0);
|
||||||
if (tu.isSourceUnit()) {
|
if (tu.isSourceUnit()) {
|
||||||
fCompletedSources++;
|
fCompletedSources++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue