mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
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
This commit is contained in:
parent
b08253b70a
commit
9655088708
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue