Thanks for the clarification on while loop.

On 11/08/2016 11:58 AM, Staffan Larsen wrote:
Spurious wakeups can cause wait() to finish early in which case the while loop 
is needed. But the timeout to wait() doesn’t add anything. And if the while 
loop is there the next statement is not needed:


112         if (li.received < 1) {
113             throw new RuntimeException("No notif received!");

Ujwal, please update webrev with the comments from Staffan above.

Thanks!

/Robbin ('r'eviewer)



On 8 Nov 2016, at 11:44, Robbin Ehn <robbin....@oracle.com> wrote:

Hi Ujwal,

synchronized(li) {
        while (li.received < 1) {
                li.wait(100);
        }
}

I don't see why we need while loop ?

To me it looks like you could just do:

synchronized(li) {
        li.wait();
}

Since either we got notification and received must be bigger than 0.
Or jtreg timed out.

/Robbin ('r'eviewer)

On 11/04/2016 12:03 PM, Ujwal Vangapally wrote:
Please review this small change for the bug below

https://bugs.openjdk.java.net/browse/JDK-8168141

Webrev:
http://cr.openjdk.java.net/~asapre/sponsorships/Ujwal/JDK-8168141/webrev.01/


Thanks,
Ujwal.

Reply via email to