diff --git a/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java b/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java index 4d885f443765bb3ae7b7ba047048fd5001c7a6af..47fdbfb9443f063b61285c5c1fed00ad07e9f01d 100644 --- a/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java +++ b/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java @@ -489,7 +489,8 @@ public abstract class AbstractQueuedLongSynchronizer /* * Try to signal next queued node if: * Propagation was indicated by caller, - * or was recorded (as h.waitStatus) by a previous operation + * or was recorded (as h.waitStatus either before + * or after setHead) by a previous operation * (note: this uses sign-check of waitStatus because * PROPAGATE status may transition to SIGNAL.) * and @@ -501,7 +502,8 @@ public abstract class AbstractQueuedLongSynchronizer * racing acquires/releases, so most need signals now or soon * anyway. */ - if (propagate > 0 || h == null || h.waitStatus < 0) { + if (propagate > 0 || h == null || h.waitStatus < 0 || + (h = head) == null || h.waitStatus < 0) { Node s = node.next; if (s == null || s.isShared()) doReleaseShared(); diff --git a/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java b/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java index f0bdeb9030e0b586a7ee528d775a140cea684f02..dce35765df71e053f579f7d87f9b9f61cff42aef 100644 --- a/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java +++ b/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java @@ -711,7 +711,8 @@ public abstract class AbstractQueuedSynchronizer /* * Try to signal next queued node if: * Propagation was indicated by caller, - * or was recorded (as h.waitStatus) by a previous operation + * or was recorded (as h.waitStatus either before + * or after setHead) by a previous operation * (note: this uses sign-check of waitStatus because * PROPAGATE status may transition to SIGNAL.) * and @@ -723,7 +724,8 @@ public abstract class AbstractQueuedSynchronizer * racing acquires/releases, so most need signals now or soon * anyway. */ - if (propagate > 0 || h == null || h.waitStatus < 0) { + if (propagate > 0 || h == null || h.waitStatus < 0 || + (h = head) == null || h.waitStatus < 0) { Node s = node.next; if (s == null || s.isShared()) doReleaseShared();