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:
parent
aa81471656
commit
71a99db46e
2 changed files with 23 additions and 1 deletions
|
@ -91,6 +91,16 @@ public class RxThread extends Thread {
|
|||
clean.setDaemon(true);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,8 @@ public class TxThread extends Thread {
|
|||
// 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.
|
||||
if (cmd.getToken() > 0) {
|
||||
Thread rx = session.getRxThread();
|
||||
if (cmd.getToken() > 0 && rx != null && rx.isAlive()) {
|
||||
CommandQueue rxQueue = session.getRxQueue();
|
||||
rxQueue.addCommand(cmd);
|
||||
} else {
|
||||
|
@ -66,5 +67,16 @@ public class TxThread extends Thread {
|
|||
} catch (IOException e) {
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue