ServerApplication: yield before we check on the dumper thread

This commit is contained in:
Havoc Pennington 2014-05-28 10:07:35 -04:00
parent 1e80d811a1
commit 007a8f2a70
1 changed files with 3 additions and 0 deletions

View File

@ -113,6 +113,9 @@ class StreamDumper(in: java.io.BufferedReader, out: java.io.PrintStream) extends
// any stuff.
if (waitForErrors) {
endTime.set(System.currentTimeMillis + 2000)
// at this point we'd rather the dumper thread run
// before we check whether to sleep
Thread.yield()
// let ourselves read more (thread should exit on earlier of endTime or EOF)
while (isAlive() && (endTime.get > System.currentTimeMillis))
Thread.sleep(50)