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