Hi Peter,

so obvious, thank you!

Oleg.

7/24/2012 3:42 PM, Peter Levart wrote:
Hi Oleg,

This is just cosmetics, but:

SunToolkit:
public synchronized boolean noEvents() {
        return queueHead == null && !isFlushing;
    }

... a thread calling noEvents could see occasional "spikes" of false return even though there is no flushing being performed (when other thread is calling flush on an empty PostEventQueue).

Improved flush method would look like this:

     public void flush() {
         EventQueueItem tempQueue;
         synchronized (this) {
             tempQueue = queueHead;
             queueHead = queueTail = null;
             isFlushing =*/(tempQueue != null)/*;
         }
         try {
             while (tempQueue != null) {
                 eventQueue.postEvent(tempQueue.event);
                 tempQueue = tempQueue.next;
             }
         }
         finally {
             isFlushing = false;
         }
     }

Regards, Peter

2012/7/23 Oleg Pekhovskiy <oleg.pekhovs...@oracle.com <mailto:oleg.pekhovs...@oracle.com>>

    Hi!

    Please review this back-port being already pushed to jdk8 but
    deferred for 7u6.

    Bug:
    http://bugs.sun.com/view_bug.do?bug_id=7177040

    Webrev:
    http://cr.openjdk.java.net/~bagiras/7u8/7177040.1
    <http://cr.openjdk.java.net/%7Ebagiras/7u8/7177040.1>

    Review thread for 7u6:
    http://mail.openjdk.java.net/pipermail/awt-dev/2012-July/003106.html

    Reviewers 7u6 & 8:
    Anthony Petrov, Anton Tarasov

    Thanks,
    Oleg



Reply via email to