133 |
|
state().set(permits); |
134 |
|
} |
135 |
|
|
136 |
< |
public final int acquireSharedState(boolean isQueued, int acquires, |
137 |
< |
Thread current) { |
136 |
> |
public int acquireSharedState(boolean isQueued, int acquires) { |
137 |
|
final AtomicInteger perms = state(); |
138 |
|
if (!isQueued && fair && hasQueuedThreads()) |
139 |
|
return -1; |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
< |
public final boolean releaseSharedState(int releases) { |
149 |
> |
public boolean releaseSharedState(int releases) { |
150 |
|
final AtomicInteger perms = state(); |
151 |
|
for (;;) { |
152 |
|
int p = perms.get(); |
155 |
|
} |
156 |
|
} |
157 |
|
|
158 |
< |
public final int acquireExclusiveState(boolean isQueued, |
160 |
< |
int acquires, |
161 |
< |
Thread current) { |
158 |
> |
public int acquireExclusiveState(boolean isQueued, int acquires) { |
159 |
|
throw new UnsupportedOperationException(); |
160 |
|
} |
161 |
|
|
251 |
|
* otherwise. |
252 |
|
*/ |
253 |
|
public boolean tryAcquire() { |
254 |
< |
return sync.acquireSharedState(false, 1, null) >= 0; |
254 |
> |
return sync.acquireSharedState(false, 1) >= 0; |
255 |
|
} |
256 |
|
|
257 |
|
/** |
408 |
|
*/ |
409 |
|
public boolean tryAcquire(int permits) { |
410 |
|
if (permits < 0) throw new IllegalArgumentException(); |
411 |
< |
return sync.acquireSharedState(false, permits, null) >= 0; |
411 |
> |
return sync.acquireSharedState(false, permits) >= 0; |
412 |
|
} |
413 |
|
|
414 |
|
/** |