mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
fix logic in Thread.join(long)
This commit is contained in:
parent
44e3ee5bd7
commit
a064c744f4
@ -265,10 +265,12 @@ public class Thread implements Runnable {
|
|||||||
public synchronized void join(long milliseconds) throws InterruptedException
|
public synchronized void join(long milliseconds) throws InterruptedException
|
||||||
{
|
{
|
||||||
long then = System.currentTimeMillis();
|
long then = System.currentTimeMillis();
|
||||||
|
long remaining = milliseconds;
|
||||||
while (getState() != State.TERMINATED) {
|
while (getState() != State.TERMINATED) {
|
||||||
wait();
|
wait(remaining);
|
||||||
|
|
||||||
if (System.currentTimeMillis() - then >= milliseconds) {
|
remaining = milliseconds - (System.currentTimeMillis() - then);
|
||||||
|
if (remaining <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user