more responsive checkCanceled

This commit is contained in:
Alexey Kudravtsev
2013-01-21 12:24:31 +04:00
parent 0c407097d0
commit f21ab0e564
3 changed files with 2 additions and 8 deletions
@@ -51,7 +51,7 @@ public abstract class ProgressIndicatorProvider {
};
}
public static boolean ourNeedToCheckCancel = false;
public static volatile boolean ourNeedToCheckCancel = false;
public static void checkCanceled() throws ProcessCanceledException {
// smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
if (ourNeedToCheckCancel && ourInstance != null) {
@@ -60,7 +60,7 @@ public abstract class ProgressManager {
public abstract ProgressIndicator getProgressIndicator();
protected static boolean ourNeedToCheckCancel = false;
protected static volatile boolean ourNeedToCheckCancel = false;
public static void checkCanceled() throws ProcessCanceledException {
// smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
if (ourNeedToCheckCancel) {
@@ -527,12 +527,6 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable{
((ProgressManagerImpl)getInstance()).dispose();
}
@TestOnly
public static void setNeedToCheckCancel(boolean needToCheckCancel) {
ourNeedToCheckCancel = needToCheckCancel;
ProgressIndicatorProvider.ourNeedToCheckCancel = true;
}
@TestOnly
@SuppressWarnings({"UnusedDeclaration"})
public static String isCanceledThread(Thread thread) {