提交 c6407fec 编写于 作者: D dl

7011859: java/util/concurrent/Semaphore/RacingReleases.java failing

Reviewed-by: alanb, dholmes
上级 477f55b9
...@@ -489,7 +489,8 @@ public abstract class AbstractQueuedLongSynchronizer ...@@ -489,7 +489,8 @@ public abstract class AbstractQueuedLongSynchronizer
/* /*
* Try to signal next queued node if: * Try to signal next queued node if:
* Propagation was indicated by caller, * 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 * (note: this uses sign-check of waitStatus because
* PROPAGATE status may transition to SIGNAL.) * PROPAGATE status may transition to SIGNAL.)
* and * and
...@@ -501,7 +502,8 @@ public abstract class AbstractQueuedLongSynchronizer ...@@ -501,7 +502,8 @@ public abstract class AbstractQueuedLongSynchronizer
* racing acquires/releases, so most need signals now or soon * racing acquires/releases, so most need signals now or soon
* anyway. * 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; Node s = node.next;
if (s == null || s.isShared()) if (s == null || s.isShared())
doReleaseShared(); doReleaseShared();
......
...@@ -711,7 +711,8 @@ public abstract class AbstractQueuedSynchronizer ...@@ -711,7 +711,8 @@ public abstract class AbstractQueuedSynchronizer
/* /*
* Try to signal next queued node if: * Try to signal next queued node if:
* Propagation was indicated by caller, * 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 * (note: this uses sign-check of waitStatus because
* PROPAGATE status may transition to SIGNAL.) * PROPAGATE status may transition to SIGNAL.)
* and * and
...@@ -723,7 +724,8 @@ public abstract class AbstractQueuedSynchronizer ...@@ -723,7 +724,8 @@ public abstract class AbstractQueuedSynchronizer
* racing acquires/releases, so most need signals now or soon * racing acquires/releases, so most need signals now or soon
* anyway. * 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; Node s = node.next;
if (s == null || s.isShared()) if (s == null || s.isShared())
doReleaseShared(); doReleaseShared();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册