diff options
author | Marc Khouzam | 2016-03-29 14:45:43 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-05-10 12:48:16 +0000 |
commit | 9655088708bc5f5c3277d9ddc3c224b3a27320f8 (patch) | |
tree | fbce2a780b2ca4582a1d34da3763fb27a8a05078 /dsf-gdb/org.eclipse.cdt.dsf.gdb.ui | |
parent | b08253b70a951ae9be5e3f448667751dbb112c58 (diff) | |
download | org.eclipse.cdt-9655088708bc5f5c3277d9ddc3c224b3a27320f8.tar.gz org.eclipse.cdt-9655088708bc5f5c3277d9ddc3c224b3a27320f8.tar.xz org.eclipse.cdt-9655088708bc5f5c3277d9ddc3c224b3a27320f8.zip |
Provide a timeout for query that might run in UI thread.
GdbReverseToggleCommand extends AbstractDebugCommand so as to be able to
block without risking a deadlock. However, this only applies to
doExecute() and isExecutable().
GdbReverseToggleCommand has two other methods that use queries, and
those are at risk of a deadlock: isReverseToggled() and
getReverseDebugMethod(). Those queries must have a timeout to avoid any
risk of deadlock.
Change-Id: Ia410b8f102638965ccbf8ac9deda06dc4efc5f0d
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb.ui')
-rw-r--r-- | dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java index d66b1b78cb0..8b910639b8f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbReverseToggleCommand.java @@ -279,12 +279,15 @@ public class GdbReverseToggleCommand extends AbstractDebugCommand implements ICh }; try { fExecutor.execute(isToggledQuery); - return isToggledQuery.get(); + return isToggledQuery.get(500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { } catch (ExecutionException e) { } catch (RejectedExecutionException e) { // Can be thrown if the session is shutdown - } + } catch (TimeoutException e) { + // If we timeout, we default to false. + // This is to avoid a deadlock + } return false; } @@ -390,6 +393,8 @@ public class GdbReverseToggleCommand extends AbstractDebugCommand implements ICh } catch (ExecutionException e) { } catch (RejectedExecutionException e) { } catch (TimeoutException e) { + // If we timeout, we default to OFF. + // This is to avoid a deadlock } return ReverseDebugMethod.OFF; |