1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 10:15:39 +02:00

Clear queue when done.

This commit is contained in:
Alain Magloire 2002-10-13 02:28:28 +00:00
parent aa81471656
commit 71a99db46e
2 changed files with 23 additions and 1 deletions

View file

@ -91,6 +91,16 @@ public class RxThread extends Thread {
clean.setDaemon(true); clean.setDaemon(true);
clean.start(); clean.start();
} }
// Clear the queue and notify any command waiting, we are going down.
CommandQueue rxQueue = session.getRxQueue();
if (rxQueue != null) {
Command[] cmds = rxQueue.clearCommands();
for (int i = 0; i < cmds.length; i++) {
synchronized (cmds[i]) {
cmds[i].notifyAll();
}
}
}
} }
/** /**

View file

@ -46,7 +46,8 @@ public class TxThread extends Thread {
// Move to the RxQueue only if we have // Move to the RxQueue only if we have
// a valid token, this is to permit input(HACK!) // a valid token, this is to permit input(HACK!)
// or commands that do not want to wait for responses. // or commands that do not want to wait for responses.
if (cmd.getToken() > 0) { Thread rx = session.getRxThread();
if (cmd.getToken() > 0 && rx != null && rx.isAlive()) {
CommandQueue rxQueue = session.getRxQueue(); CommandQueue rxQueue = session.getRxQueue();
rxQueue.addCommand(cmd); rxQueue.addCommand(cmd);
} else { } else {
@ -66,5 +67,16 @@ public class TxThread extends Thread {
} catch (IOException e) { } catch (IOException e) {
//e.printStackTrace(); //e.printStackTrace();
} }
// Clear the queue and notify any command waiting, we are going down.
CommandQueue txQueue = session.getTxQueue();
if (txQueue != null) {
Command[] cmds = txQueue.clearCommands();
for (int i = 0; i < cmds.length; i++) {
synchronized (cmds[i]) {
cmds[i].notifyAll();
}
}
}
} }
} }