1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

- add sync to process methods of abstarct checker class because only one of checker is used and it can run in parallel

This commit is contained in:
Alena Laskavaia 2010-04-18 02:28:39 +00:00
parent 556a433366
commit ca52c0a338
2 changed files with 4 additions and 3 deletions

View file

@ -34,7 +34,7 @@ public abstract class AbstractCIndexChecker extends AbstractChecker implements I
return file;
}
void processFile(IFile file) throws CoreException, InterruptedException {
void processFile(IFile file) throws CoreException, InterruptedException {
// create translation unit and access index
ICElement model = CoreModel.getDefault().create(file);
if (!(model instanceof ITranslationUnit)) return; // not a C/C++ file
@ -52,7 +52,7 @@ public abstract class AbstractCIndexChecker extends AbstractChecker implements I
}
}
public boolean processResource(IResource resource) {
public synchronized boolean processResource(IResource resource) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
try {

View file

@ -61,6 +61,7 @@ public abstract class AbstractIndexAstChecker extends AbstractChecker implements
// create index based ast
IASTTranslationUnit ast = tu.getAST(index,
ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
if (ast==null) return;//
// traverse the ast using the visitor pattern.
this.file = file;
processAst(ast);
@ -70,7 +71,7 @@ public abstract class AbstractIndexAstChecker extends AbstractChecker implements
}
}
public boolean processResource(IResource resource) {
public synchronized boolean processResource(IResource resource) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
try {