mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Bug 359783 - (Fix matching of timed-out event contexts and tracking
timed-out flags)
This commit is contained in:
parent
bdd74fd79e
commit
d722e5a8f6
1 changed files with 19 additions and 11 deletions
|
@ -431,7 +431,7 @@ public final class SteppingController {
|
||||||
getRunControl().step(execCtx, stepType, new RequestMonitor(getExecutor(), null) {
|
getRunControl().step(execCtx, stepType, new RequestMonitor(getExecutor(), null) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
fTimedOutFlags.put(execCtx, Boolean.FALSE);
|
fTimedOutFlags.remove(execCtx);
|
||||||
ScheduledFuture<?> currentTimeOutFuture = fTimedOutFutures.get(execCtx);
|
ScheduledFuture<?> currentTimeOutFuture = fTimedOutFutures.get(execCtx);
|
||||||
if (currentTimeOutFuture != null) {
|
if (currentTimeOutFuture != null) {
|
||||||
currentTimeOutFuture.cancel(false);
|
currentTimeOutFuture.cancel(false);
|
||||||
|
@ -625,10 +625,16 @@ public final class SteppingController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cancel all time-out futures related to the event context. I.e.
|
||||||
|
// - If event is on a container, all child threads are suspended and
|
||||||
|
// should not issue a stepping time-out event.
|
||||||
|
// - If event is on a thread, and resumed event was on a container then
|
||||||
|
// stepping timeout for container should be canceled as it would affect
|
||||||
|
// suspended thread.
|
||||||
for (Iterator<Map.Entry<IExecutionDMContext, ScheduledFuture<?>>> itr = fTimedOutFutures.entrySet().iterator(); itr.hasNext();) {
|
for (Iterator<Map.Entry<IExecutionDMContext, ScheduledFuture<?>>> itr = fTimedOutFutures.entrySet().iterator(); itr.hasNext();) {
|
||||||
Map.Entry<IExecutionDMContext, ScheduledFuture<?>> entry = itr.next();
|
Map.Entry<IExecutionDMContext, ScheduledFuture<?>> entry = itr.next();
|
||||||
IExecutionDMContext nextDmc = entry.getKey();
|
IExecutionDMContext nextDmc = entry.getKey();
|
||||||
if (nextDmc.equals(dmc) || DMContexts.isAncestorOf(entry.getKey(), dmc)) {
|
if (nextDmc.equals(dmc) || DMContexts.isAncestorOf(nextDmc, dmc) || DMContexts.isAncestorOf(dmc, nextDmc)) {
|
||||||
entry.getValue().cancel(false);
|
entry.getValue().cancel(false);
|
||||||
itr.remove();
|
itr.remove();
|
||||||
}
|
}
|
||||||
|
@ -647,20 +653,22 @@ public final class SteppingController {
|
||||||
public void eventDispatched(final IResumedDMEvent e) {
|
public void eventDispatched(final IResumedDMEvent e) {
|
||||||
if (e.getReason().equals(StateChangeReason.STEP)) {
|
if (e.getReason().equals(StateChangeReason.STEP)) {
|
||||||
final IExecutionDMContext dmc = e.getDMContext();
|
final IExecutionDMContext dmc = e.getDMContext();
|
||||||
fTimedOutFlags.put(dmc, Boolean.FALSE);
|
fTimedOutFlags.remove(dmc);
|
||||||
|
|
||||||
|
|
||||||
// Find any time-out futures for contexts that are children of the
|
// Find any time-out futures for contexts that are children of the
|
||||||
// resumed context, and cancel them as they'll be replaced.
|
// resumed context, and cancel them as they'll be replaced.
|
||||||
for (Iterator<Map.Entry<IExecutionDMContext, ScheduledFuture<?>>> itr = fTimedOutFutures.entrySet().iterator(); itr.hasNext();) {
|
if (!fTimedOutFutures.containsKey(dmc)) {
|
||||||
Map.Entry<IExecutionDMContext, ScheduledFuture<?>> entry = itr.next();
|
for (Iterator<Map.Entry<IExecutionDMContext, ScheduledFuture<?>>> itr = fTimedOutFutures.entrySet().iterator(); itr.hasNext();) {
|
||||||
if (DMContexts.isAncestorOf(entry.getKey(), dmc) && !dmc.equals(entry.getKey())) {
|
Map.Entry<IExecutionDMContext, ScheduledFuture<?>> entry = itr.next();
|
||||||
entry.getValue().cancel(false);
|
if (DMContexts.isAncestorOf(entry.getKey(), dmc)) {
|
||||||
itr.remove();
|
entry.getValue().cancel(false);
|
||||||
}
|
itr.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fTimedOutFutures.put(dmc, getExecutor().schedule(new TimeOutRunnable(dmc), fStepTimeout, TimeUnit.MILLISECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
fTimedOutFutures.put(dmc, getExecutor().schedule(new TimeOutRunnable(dmc), fStepTimeout, TimeUnit.MILLISECONDS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue