1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Clear the event queue when terminating.

This commit is contained in:
Alain Magloire 2003-04-22 20:56:34 +00:00
parent b7fc69bdac
commit ebc59cc62c

View file

@ -356,11 +356,6 @@ public class MISession extends Observable {
// Destroy any MI Inferior(Process) and streams.
inferior.destroy();
// Tell the observers that the session
// is finish, but we can not use the Event Thread.
// The Event Thread is being kill below.
notifyObservers(new MIGDBExitEvent(0));
// {in,out}Channel is use as predicate/condition
// in the {RX,TX,Event}Thread to detect termination
// and bail out. So they are set to null.
@ -433,6 +428,15 @@ public class MISession extends Observable {
} catch (InterruptedException e) {
}
// Allow (10 secs) for the EventThread to finish processing the queue.
Queue queue = getEventQueue();
for (int i = 0; !queue.isEmpty() && i < 5; i++) {
try {
java.lang.Thread.sleep(2000);
} catch (InterruptedException e) {
}
}
// Kill the event Thread.
try {
if (eventThread.isAlive()) {
@ -441,6 +445,15 @@ public class MISession extends Observable {
}
} catch (InterruptedException e) {
}
// Flush the queue.
queue.clearItems();
// Tell the observers that the session
// is finish, but we can not use the Event Thread.
// The Event Thread was kill above.
notifyObservers(new MIGDBExitEvent(0));
}
/**