214 |
|
} |
215 |
|
|
216 |
|
/** |
217 |
< |
* Blocks a worker thread until completion. Called only by pool. |
217 |
> |
* Blocks a worker thread until completion. Called only by |
218 |
> |
* pool. Currently unused -- pool-based waits use timeout |
219 |
> |
* version below. |
220 |
|
*/ |
221 |
|
final void internalAwaitDone() { |
222 |
|
int s; // the odd construction reduces lock bias effects |
233 |
|
} |
234 |
|
|
235 |
|
/** |
236 |
+ |
* Blocks a worker thread until completed or timed out. Called |
237 |
+ |
* only by pool. |
238 |
+ |
* |
239 |
+ |
* @return status on exit |
240 |
+ |
*/ |
241 |
+ |
final int internalAwaitDone(long millis) { |
242 |
+ |
int s; |
243 |
+ |
if ((s = status) >= 0) { |
244 |
+ |
try { |
245 |
+ |
synchronized(this) { |
246 |
+ |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL)) |
247 |
+ |
wait(millis, 0); |
248 |
+ |
} |
249 |
+ |
} catch (InterruptedException ie) { |
250 |
+ |
cancelIfTerminating(); |
251 |
+ |
} |
252 |
+ |
s = status; |
253 |
+ |
} |
254 |
+ |
return s; |
255 |
+ |
} |
256 |
+ |
|
257 |
+ |
/** |
258 |
|
* Blocks a non-worker-thread until completion. |
259 |
|
*/ |
260 |
|
private void externalAwaitDone() { |