Skip to main content
summaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorMario Pierro2016-03-08 20:20:28 -0500
committerGerrit Code Review @ Eclipse.org2016-03-11 10:10:06 -0500
commitadbed0ba769661a266d7ea46cfd91bec2c8786f5 (patch)
treecaee3b8a8b50018695ef20c380d73a15711d273e /dsf
parent6a61206d08f25467891b42285948a0076b64bedf (diff)
downloadorg.eclipse.cdt-adbed0ba769661a266d7ea46cfd91bec2c8786f5.tar.gz
org.eclipse.cdt-adbed0ba769661a266d7ea46cfd91bec2c8786f5.tar.xz
org.eclipse.cdt-adbed0ba769661a266d7ea46cfd91bec2c8786f5.zip
Bug 302305 - Added a timeout to queries which are run more frequently.
Change-Id: I3d3cf27c6f7fda7171633b9e70d26c4d3a89e2dd Signed-off-by: Mario Pierro <mario.pierro@iar.com>
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java8
4 files changed, 45 insertions, 6 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java
new file mode 100644
index 0000000000..1aafb23c9d
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IAR Systems AB
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IAR Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+/**
+ * Constants used by the DSF UI action adapters
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+interface IDsfActionsConstants {
+ /**
+ * The timeout in ms which action adapters will wait before disabling
+ * the action itself, in order to avoid blocking the UI thread while
+ * waiting for the DSF thread to service a blocking query.
+ */
+ static final int ACTION_ADAPTERS_TIMEOUT_MS = 500;
+
+}
+
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
index 6d6c8b209b..f747fc86f5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
@@ -12,6 +12,8 @@ package org.eclipse.cdt.dsf.debug.internal.ui.actions;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.model.IMoveToAddress;
@@ -63,10 +65,11 @@ public class MoveToLine implements IMoveToLine, IMoveToAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;
@@ -134,10 +137,11 @@ public class MoveToLine implements IMoveToLine, IMoveToAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
index ee8dd54d89..d3541eb4f4 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
@@ -12,6 +12,8 @@ package org.eclipse.cdt.dsf.debug.internal.ui.actions;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.model.IResumeAtAddress;
@@ -69,10 +71,11 @@ public class ResumeAtLine implements IResumeAtLine, IResumeAtAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;
@@ -145,10 +148,11 @@ public class ResumeAtLine implements IResumeAtLine, IResumeAtAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
index 9b0e335b0b..95233bda4d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
@@ -13,6 +13,8 @@ package org.eclipse.cdt.dsf.debug.internal.ui.actions;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
@@ -72,10 +74,11 @@ public class RunToLine implements IRunToLine, IRunToAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;
@@ -148,10 +151,11 @@ public class RunToLine implements IRunToLine, IRunToAddress {
}
};
session.getExecutor().execute(query);
- return query.get();
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
+ } catch (TimeoutException e) {
}
}
return false;

Back to the top