mirror of https://github.com/sbt/sbt.git
Avoid throwing interrupted exception in JoinThread
I saw a stacktrace when exiting sbtn on windows due to an interrupted exception being thrown during thread joining. We only want to throw this exception if we didn't successfully join the thread. I also noticed that we would try to join the thread forever. There was supposed to be a timelimit so that we would eventually stop blocking even if we were unable to join the thread. The limit was set but not respected.
This commit is contained in:
parent
b5fc17cc7a
commit
c66f31d8a1
|
|
@ -20,11 +20,13 @@ object JoinThread {
|
||||||
t.interrupt()
|
t.interrupt()
|
||||||
t.join(10)
|
t.join(10)
|
||||||
} catch { case e: InterruptedException => exception = Some(e) }
|
} catch { case e: InterruptedException => exception = Some(e) }
|
||||||
if (t.isAlive) impl()
|
if (t.isAlive && !deadline.isOverdue) impl()
|
||||||
}
|
}
|
||||||
impl()
|
impl()
|
||||||
if (t.isAlive) System.err.println(s"Unable to join thread $t after $duration")
|
if (t.isAlive) {
|
||||||
|
System.err.println(s"Unable to join thread $t after $duration")
|
||||||
exception.foreach(throw _)
|
exception.foreach(throw _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue