1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 01:05:38 +02:00

More robust handing of indexer cancellation.

Change-Id: I5c2baf7fab8560a0cc11bfc74994b6e9135e7cce
This commit is contained in:
Sergey Prigogin 2016-05-27 11:10:59 -07:00
parent 260b6dadac
commit a4cd53a926

View file

@ -127,6 +127,7 @@ public class PDOMIndexerJob extends Job {
sMonitorDetail= name; sMonitorDetail= name;
} }
}; };
do { do {
synchronized (taskMutex) { synchronized (taskMutex) {
currentTask= null; currentTask= null;
@ -158,25 +159,30 @@ public class PDOMIndexerJob extends Job {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (OperationCanceledException e) {
} }
} }
} while (currentTask != null); } while (currentTask != null);
return Status.OK_STATUS; return Status.OK_STATUS;
} catch (OperationCanceledException e) {
indexingAborted();
throw e;
} catch (RuntimeException | Error e) { } catch (RuntimeException | Error e) {
CCorePlugin.log(e); CCorePlugin.log(e);
pdomManager.cancelledIndexerJob(true); indexingAborted();
synchronized (taskMutex) {
currentTask= null;
taskMutex.notifyAll();
}
throw e; throw e;
} finally { } finally {
synchronized (this) { synchronized (this) {
fMonitor= null; fMonitor= null;
} }
monitorJob.cancel(); monitorJob.cancel();
monitor.done(); }
}
private void indexingAborted() {
pdomManager.cancelledIndexerJob(true);
synchronized (taskMutex) {
currentTask= null;
taskMutex.notifyAll();
} }
} }