From 5a5caee142866cd86066a90f6c55ebca4799408a Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 22 Apr 2014 11:43:41 -0700 Subject: [PATCH] Improved reliability of indexer cancellation. --- .../cdt/internal/core/pdom/PDOMIndexerJob.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMIndexerJob.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMIndexerJob.java index 2e6f88f6da9..fa6e73bbc35 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMIndexerJob.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMIndexerJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 QNX Software Systems + * Copyright (c) 2005, 2014 QNX Software Systems * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * Doug Schaefer (QNX Software Systems) - initial API and implementation * Markus Schorn (Wind River Systems) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom; @@ -140,7 +141,8 @@ public class PDOMIndexerJob extends Job { System.out.println("Indexer: completed " + name + "[" + time + "ms]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + // An interrupt cancels the current task. + Thread.interrupted(); // Clear interrupted status. } catch (OperationCanceledException e) { } } @@ -198,7 +200,15 @@ public class PDOMIndexerJob extends Job { } } } - + + @Override + protected void canceling() { + Thread currThread = getThread(); + if (currThread != null) { + currThread.interrupt(); + } + } + @Override public boolean belongsTo(Object family) { return family == pdomManager;