diff --git a/platform/vcs-impl/src/com/intellij/util/continuation/GeneralRunner.java b/platform/vcs-impl/src/com/intellij/util/continuation/GeneralRunner.java index 04c3376e8df8..1ddfbb48bc48 100644 --- a/platform/vcs-impl/src/com/intellij/util/continuation/GeneralRunner.java +++ b/platform/vcs-impl/src/com/intellij/util/continuation/GeneralRunner.java @@ -245,11 +245,11 @@ abstract class GeneralRunner implements ContinuationContext { @Nullable protected TaskDescriptor getNextMatching() { while (true) { + if (myTriggerSuspend) { + return null; + } synchronized (myQueueLock) { if (myQueue.isEmpty()) return null; - if (myTriggerSuspend) { - return null; - } TaskDescriptor current = myQueue.remove(0); // check if some tasks were scheduled after disaster was thrown, anyway, they should also be checked for cure if (! current.isHaveMagicCure()) { diff --git a/platform/vcs-impl/src/com/intellij/util/continuation/SameProgressRunner.java b/platform/vcs-impl/src/com/intellij/util/continuation/SameProgressRunner.java index ae1172ce8e37..5ab3bab2364b 100644 --- a/platform/vcs-impl/src/com/intellij/util/continuation/SameProgressRunner.java +++ b/platform/vcs-impl/src/com/intellij/util/continuation/SameProgressRunner.java @@ -68,16 +68,14 @@ public class SameProgressRunner extends GeneralRunner { final TaskDescriptor current = getNextMatching(); if (current == null) { - synchronized (myQueueLock) { - if (myTriggerSuspend) { - mySemaphore.down(); - while (myTriggerSuspend) { - mySemaphore.waitFor(500); - } - continue; - } else { - return; + if (myTriggerSuspend) { + mySemaphore.down(); + while (myTriggerSuspend) { + mySemaphore.waitFor(500); } + continue; + } else { + return; } }