# | Line 136 | Line 136 | public class CountDownLatch { | |
---|---|---|
136 | return getState(); | |
137 | } | |
138 | ||
139 | < | public int tryAcquireShared(boolean isQueued, int acquires) { |
139 | > | public int tryAcquireShared(int acquires) { |
140 | return getState() == 0? 1 : -1; | |
141 | } | |
142 | ||
# | Line 146 | Line 146 | public class CountDownLatch { | |
146 | int c = getState(); | |
147 | if (c == 0) | |
148 | return false; | |
149 | < | if (compareAndSetState(c, c-1)) |
150 | < | return c == 1; |
149 | > | int nextc = c-1; |
150 | > | if (compareAndSetState(c, nextc)) |
151 | > | return nextc == 0; |
152 | } | |
153 | } | |
154 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |