1251 |
|
* thread to enter a wait state: BLOCKED, WAITING, or TIMED_WAITING. |
1252 |
|
*/ |
1253 |
|
void waitForThreadToEnterWaitState(Thread thread, long timeoutMillis) { |
1254 |
< |
long startTime = System.nanoTime(); |
1254 |
> |
long startTime = 0L; |
1255 |
|
for (;;) { |
1256 |
|
Thread.State s = thread.getState(); |
1257 |
|
if (s == Thread.State.BLOCKED || |
1260 |
|
return; |
1261 |
|
else if (s == Thread.State.TERMINATED) |
1262 |
|
fail("Unexpected thread termination"); |
1263 |
+ |
else if (startTime == 0L) |
1264 |
+ |
startTime = System.nanoTime(); |
1265 |
|
else if (millisElapsedSince(startTime) > timeoutMillis) { |
1266 |
|
threadAssertTrue(thread.isAlive()); |
1267 |
|
return; |