Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ public MockDownload await() throws InterruptedException {
thread.start();
}
latch.await();
// Spin until the thread reaches barrier.await() (WAITING state).
// latch.countDown() happens before barrier.await(), so there is a window
// where latch==0 but the thread hasn't entered the barrier yet.
// Assumes the barrier has not fired yet; otherwise WAITING could mean
// exchanger.exchange() rather than barrier.await().
while (thread.isAlive() && thread.getState() != Thread.State.WAITING) {
Thread.onSpinWait();
}
return this;
}

Expand Down
Loading