jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
changeset 2165 98373487fcf4
parent 2 90ce3da70b43
child 2430 975a98680ae8
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Feb 24 14:22:08 2009 +0000
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Feb 24 14:01:45 2009 -0800
@@ -1222,8 +1222,10 @@
         // The correctness of this depends on head being initialized
         // before tail and on head.next being accurate if the current
         // thread is first in queue.
-        Node h, s;
-        return (h = head) != tail &&
+        Node t = tail; // Read fields in reverse initialization order
+        Node h = head;
+        Node s;
+        return h != t &&
             ((s = h.next) == null || s.thread != Thread.currentThread());
     }