Also bumped the timeout on await() to 500 ms. It means that, on
average, the user will have to wait 250 ms after clicking on
the cancel button actually cancels the running analysis. 1 ms
was burning CPU cycles for nothing.
Change-Id: Id716c761a60b97d53d6809d0457e4f30b63f655e
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/21590
Tested-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
IP-Clean: Genevieve Bastien <gbastien+lttng@versatic.net>
* Set the countdown latch back to 1 so the analysis can be executed again
*/
protected void resetAnalysis() {
+ fFinishedLatch.countDown();
fFinishedLatch = new CountDownLatch(1);
}
@Override
public boolean waitForCompletion(IProgressMonitor monitor) {
try {
- while (!fFinishedLatch.await(1, TimeUnit.MILLISECONDS)) {
- if (monitor.isCanceled()) {
+ while (!fFinishedLatch.await(500, TimeUnit.MILLISECONDS)) {
+ if (fAnalysisCancelled || monitor.isCanceled()) {
fAnalysisCancelled = true;
return false;
}