diff options
author | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-16 16:15:49 +0000 |
---|---|---|
committer | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-16 16:15:49 +0000 |
commit | 2878d76b2a9774307da3dc7e261b9162aa714d54 (patch) | |
tree | 23d41a020b7d3f81a3015111bd82e8f4e329bb48 /libjava/java/awt/EventQueue.java | |
parent | d891500a27d110de5b29032975f64ab29179f293 (diff) | |
download | ppe42-gcc-2878d76b2a9774307da3dc7e261b9162aa714d54.tar.gz ppe42-gcc-2878d76b2a9774307da3dc7e261b9162aa714d54.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75977 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/awt/EventQueue.java')
-rw-r--r-- | libjava/java/awt/EventQueue.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java index d20edbc13b0..fe9138fa3f7 100644 --- a/libjava/java/awt/EventQueue.java +++ b/libjava/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; } } |