< prev index next >
src/share/classes/sun/awt/SunToolkit.java
Print this page
@@ -1618,13 +1618,13 @@
* <code>true</code> if some events were processed,
* <code>false</code> otherwise.
*/
protected abstract boolean syncNativeQueue(final long timeout);
- private boolean eventDispatched = false;
- private boolean queueEmpty = false;
- private final Object waitLock = "Wait Lock";
+ private boolean eventDispatched;
+ private boolean queueEmpty;
+ private final Object waitLock = new Object();
private boolean isEQEmpty() {
EventQueue queue = getSystemEventQueueImpl();
return AWTAccessor.getEventQueueAccessor().noEvents(queue);
}
@@ -1637,14 +1637,15 @@
* necessary, <code>false</code> otherwise.
*/
@SuppressWarnings("serial")
protected final boolean waitForIdle(final long timeout) {
flushPendingEvents();
- boolean queueWasEmpty = isEQEmpty();
+ final boolean queueWasEmpty;
+ synchronized (waitLock) {
+ queueWasEmpty = isEQEmpty();
queueEmpty = false;
eventDispatched = false;
- synchronized(waitLock) {
postEvent(AppContext.getAppContext(),
new PeerEvent(getSystemEventQueueImpl(), null, PeerEvent.LOW_PRIORITY_EVENT) {
public void dispatch() {
// Here we block EDT. It could have some
// events, it should have dispatched them by
< prev index next >