Merge pull request #6024 from eatkins/join-thread

Avoid throwing interrupted exception in JoinThread
This commit is contained in:
eugene yokota 2020-10-25 21:33:45 -04:00 committed by GitHub
commit a757f3e6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -20,11 +20,13 @@ object JoinThread {
t.interrupt()
t.join(10)
} catch { case e: InterruptedException => exception = Some(e) }
if (t.isAlive) impl()
if (t.isAlive && !deadline.isOverdue) impl()
}
impl()
if (t.isAlive) System.err.println(s"Unable to join thread $t after $duration")
exception.foreach(throw _)
if (t.isAlive) {
System.err.println(s"Unable to join thread $t after $duration")
exception.foreach(throw _)
}
}
}
}