changeset 1973:1c56524d207d

6699589: java/awt/EventQueue/PostEventOrderingTest.java fails Reviewed-by: dav, anthony
author art
date Wed, 26 Nov 2008 16:25:16 +0300
parents 8aeb4ecbfa44
children 1e1487c04864
files jdk/src/share/classes/sun/awt/SunToolkit.java
diffstat 1 files changed, 6 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue Oct 28 17:06:12 2008 +0300
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Nov 26 16:25:16 2008 +0300
@@ -2008,26 +2008,12 @@
     /*
      * Continually post pending AWTEvents to the Java EventQueue.
      */
-    public void flush() {
-        if (queueHead != null) {
-            EventQueueItem tempQueue;
-            /*
-             * We have to execute the loop inside the synchronized block
-             * to ensure that the flush is completed before a new event
-             * can be posted to this queue.
-             */
-            synchronized (this) {
-                tempQueue = queueHead;
-                queueHead = queueTail = null;
-                /*
-                 * If this PostEventQueue is flushed in parallel on two
-                 * different threads tempQueue will be null for one of them.
-                 */
-                while (tempQueue != null) {
-                    eventQueue.postEvent(tempQueue.event);
-                    tempQueue = tempQueue.next;
-                }
-            }
+    public synchronized void flush() {
+        EventQueueItem tempQueue = queueHead;
+        queueHead = queueTail = null;
+        while (tempQueue != null) {
+            eventQueue.postEvent(tempQueue.event);
+            tempQueue = tempQueue.next;
         }
     }