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

223521: fix for race condition encountered in GeneratePDOM.run

This commit is contained in:
Andrew Ferguson 2008-05-02 14:54:05 +00:00
parent 3fb7973084
commit 0c05265d7d
2 changed files with 16 additions and 4 deletions

View file

@ -1344,7 +1344,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
/** /**
* @param indexerSetupParticipant * @param participant
* @param project * @param project
*/ */
public void notifyIndexerSetup(IndexerSetupParticipant participant, ICProject project) { public void notifyIndexerSetup(IndexerSetupParticipant participant, ICProject project) {
@ -1369,4 +1369,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
/**
* @param project
* @return whether the specified project has been registered. If a project has
* been registered, clients can call joinIndexer with the knowledge tasks have
* been enqueued.
*/
public boolean isProjectRegistered(ICProject project) {
return getIndexer(project) != null;
}
} }

View file

@ -70,10 +70,12 @@ public class GeneratePDOM implements ISafeRunnable {
try { try {
final IIndexManager im = CCorePlugin.getIndexManager(); final IIndexManager im = CCorePlugin.getIndexManager();
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
if(CCoreInternals.getPDOMManager().isProjectRegistered(cproject)) {
im.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor()); im.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
if (!im.isIndexerSetupPostponed(cproject)) { if (!im.isIndexerSetupPostponed(cproject)) {
break; break;
} }
}
Thread.sleep(200); Thread.sleep(200);
} }