1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

token is no longer incremented here.

This commit is contained in:
Alain Magloire 2002-10-26 20:29:10 +00:00
parent d22acaff8c
commit 048ad592fd

View file

@ -20,13 +20,10 @@ import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
public class TxThread extends Thread { public class TxThread extends Thread {
MISession session; MISession session;
int token;
public TxThread(MISession s) { public TxThread(MISession s) {
super("MI TX Thread"); super("MI TX Thread");
session = s; session = s;
// start at one, zero is special means no token.
token = 1;
} }
public void run () { public void run () {
@ -44,13 +41,9 @@ public class TxThread extends Thread {
} }
if (cmd != null) { if (cmd != null) {
// Give the command a token and increment. // Move to the RxQueue only if RxThread is alive.
cmd.setToken(token++);
// Move to the RxQueue only if we have
// a valid token, this is to permit input(HACK!)
// or commands that do not want to wait for responses.
Thread rx = session.getRxThread(); Thread rx = session.getRxThread();
if (cmd.getToken() > 0 && rx != null && rx.isAlive()) { if (rx != null && rx.isAlive()) {
CommandQueue rxQueue = session.getRxQueue(); CommandQueue rxQueue = session.getRxQueue();
rxQueue.addCommand(cmd); rxQueue.addCommand(cmd);
} else { } else {
@ -121,7 +114,7 @@ public class TxThread extends Thread {
} }
if (type != -1) { if (type != -1) {
session.getMIInferior().setRunning(); session.getMIInferior().setRunning();
MIEvent event = new MIRunningEvent(type); MIEvent event = new MIRunningEvent(cmd.getToken(), type);
session.fireEvent(event); session.fireEvent(event);
} }
} }