提交 70df236a 编写于 作者: A art

6699589: java/awt/EventQueue/PostEventOrderingTest.java fails

Reviewed-by: dav, anthony
上级 05c41020
...@@ -2008,26 +2008,12 @@ class PostEventQueue { ...@@ -2008,26 +2008,12 @@ class PostEventQueue {
/* /*
* Continually post pending AWTEvents to the Java EventQueue. * Continually post pending AWTEvents to the Java EventQueue.
*/ */
public void flush() { public synchronized void flush() {
if (queueHead != null) { EventQueueItem tempQueue = queueHead;
EventQueueItem tempQueue; queueHead = queueTail = null;
/* while (tempQueue != null) {
* We have to execute the loop inside the synchronized block eventQueue.postEvent(tempQueue.event);
* to ensure that the flush is completed before a new event tempQueue = tempQueue.next;
* 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;
}
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册