summaryrefslogtreecommitdiff
path: root/java/awt/EventQueue.java
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2004-01-26 16:11:50 +0000
committerFernando Nasser <fnasser@redhat.com>2004-01-26 16:11:50 +0000
commit1221b55e34d14de49d17910a2dd7bfb7f3a9a690 (patch)
tree22e05937a953729d344954bd5b122b048ed28454 /java/awt/EventQueue.java
parent146a289052b782b70d6827ff3b2f92e53f2c530b (diff)
downloadclasspath-1221b55e34d14de49d17910a2dd7bfb7f3a9a690.tar.gz
* java/awt/EventDispatchThread.java (run): Stop running when
interrupted. * java/awt/EventQueue.java (pop): Stop dispatch thread when done. Reset the queue after transferring its contents. (push): Start a new dispatch thread if none is running.
Diffstat (limited to 'java/awt/EventQueue.java')
-rw-r--r--java/awt/EventQueue.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/java/awt/EventQueue.java b/java/awt/EventQueue.java
index d20edbc13..fe9138fa3 100644
--- a/java/awt/EventQueue.java
+++ b/java/awt/EventQueue.java
@@ -301,8 +301,8 @@ public class EventQueue
/**
* Allows a custom EventQueue implementation to replace this one.
* All pending events are transferred to the new queue. Calls to postEvent,
- * getNextEvent, and peekEvent are forwarded to the pushed queue until it
- * is removed with a pop().
+ * getNextEvent, and peekEvent and others are forwarded to the pushed queue
+ * until it is removed with a pop().
*
* @exception NullPointerException if newEventQueue is null.
*/
@@ -320,6 +320,10 @@ public class EventQueue
return;
}
+ /* Make sure we have a live dispatch thread to drive the queue */
+ if (dispatchThread == null)
+ dispatchThread = new EventDispatchThread(this);
+
int i = next_out;
while (i != next_in)
{
@@ -361,6 +365,13 @@ public class EventQueue
if (++i == queue.length)
i = 0;
}
+ // Empty the queue so it can be reused
+ next_in = 0;
+ next_out = 0;
+
+ // Tell our EventDispatchThread that it can end execution
+ dispatchThread.interrupt ();
+ dispatchThread = null;
}
}