1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

bug 67001 - synchronize indexer job countdown, and only process job

cancel on tickdown
This commit is contained in:
Andrew Niefer 2004-06-14 18:21:28 +00:00
parent f4d51f7416
commit e9f3066ac6
2 changed files with 5 additions and 9 deletions

View file

@ -61,18 +61,14 @@ public class IndexingJob extends Job {
return ASYNC_FINISH; return ASYNC_FINISH;
} }
public void tickUp(){ synchronized public void tickUp(){
if( progressMonitor != null && progressMonitor.isCanceled() ){
jobManager.pause();
return;
}
ticks++; ticks++;
if( ticks > maxTicks ) if( ticks > maxTicks )
maxTicks = ticks; maxTicks = ticks;
updateRemainingCount( null ); updateRemainingCount( null );
} }
public void setTicks( int n ){ synchronized public void setTicks( int n ){
ticks = n; ticks = n;
if( maxTicks < ticks ) if( maxTicks < ticks )
maxTicks = ticks; maxTicks = ticks;
@ -81,7 +77,7 @@ public class IndexingJob extends Job {
updateRemainingCount( null ); updateRemainingCount( null );
} }
public int tickDown( String str ){ synchronized public int tickDown( String str ){
if( progressMonitor != null && progressMonitor.isCanceled() ){ if( progressMonitor != null && progressMonitor.isCanceled() ){
jobManager.pause(); jobManager.pause();
return 0; return 0;

View file

@ -150,7 +150,7 @@ public abstract class JobManager implements Runnable {
JobManager.verbose("-> discarding background job - " + currentJob); //$NON-NLS-1$ JobManager.verbose("-> discarding background job - " + currentJob); //$NON-NLS-1$
currentJob.cancel(); currentJob.cancel();
if( indexJob != null ){ if( indexJob != null ){
if( indexJob.tickDown( null ) == 0 ){ if( indexJob.tickDown( null ) <= 0 ){
indexJob.done( OK_STATUS ); indexJob.done( OK_STATUS );
indexJob = null; indexJob = null;
} }
@ -211,7 +211,7 @@ public abstract class JobManager implements Runnable {
progressString += job.toString(); progressString += job.toString();
progressString += ")"; //$NON-NLS-1$ progressString += ")"; //$NON-NLS-1$
} }
if( indexJob.tickDown( progressString ) == 0 ){ if( indexJob.tickDown( progressString ) <= 0 ){
indexJob.done( OK_STATUS ); indexJob.done( OK_STATUS );
indexJob = null; indexJob = null;
} }