ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/SynchronousQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/SynchronousQueue.java (file contents):
Revision 1.31 by dl, Tue Dec 30 23:55:43 2003 UTC vs.
Revision 1.32 by dl, Wed Dec 31 21:30:00 2003 UTC

# Line 92 | Line 92 | public class SynchronousQueue<E> extends
92          /**
93           * Implements AQS base acquire to succeed if not in WAITING state
94           */
95 <        public int acquireExclusiveState(boolean b, int ignore) {
96 <            return get() == WAITING ? -1 : 0;
95 >        public boolean tryAcquireExclusiveState(boolean b, int ignore) {
96 >            return getState() != WAITING;
97          }
98  
99          /**
100           * Implements AQS base release to always signal.
101           * Status is changed in ack or cancel methods before calling,
102 <         * which is needed to ensure we win cancel race.
102 >         * which is needed to handle cancellation races.
103           */
104          public boolean releaseExclusiveState(int ignore) {
105              return true;
# Line 109 | Line 109 | public class SynchronousQueue<E> extends
109           * Try to acknowledge; fail if not waiting
110           */
111          private boolean ack() {
112 <            if (!compareAndSet(WAITING, ACKED))
112 >            if (!compareAndSetState(WAITING, ACKED))
113                  return false;
114              releaseExclusive(0);
115              return true;
# Line 119 | Line 119 | public class SynchronousQueue<E> extends
119           * Try to cancel; fail if not waiting
120           */
121          private boolean cancel() {
122 <            if (!compareAndSet(WAITING, CANCELLED))
122 >            if (!compareAndSetState(WAITING, CANCELLED))
123                  return false;
124              releaseExclusive(0);
125              return true;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines