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

Improved reliability of indexer cancellation.

This commit is contained in:
Sergey Prigogin 2014-04-22 11:43:41 -07:00
parent 54fd5d6cd0
commit 5a5caee142

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Doug Schaefer (QNX Software Systems) - initial API and implementation * Doug Schaefer (QNX Software Systems) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom; 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$ System.out.println("Indexer: completed " + name + "[" + time + "ms]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); // An interrupt cancels the current task.
Thread.interrupted(); // Clear interrupted status.
} catch (OperationCanceledException e) { } catch (OperationCanceledException e) {
} }
} }
@ -199,6 +201,14 @@ public class PDOMIndexerJob extends Job {
} }
} }
@Override
protected void canceling() {
Thread currThread = getThread();
if (currThread != null) {
currThread.interrupt();
}
}
@Override @Override
public boolean belongsTo(Object family) { public boolean belongsTo(Object family) {
return family == pdomManager; return family == pdomManager;