fix freezing when exiting

This commit is contained in:
Bixilon 2021-11-01 17:03:53 +01:00
parent d683669055
commit 3ab21830d6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -136,6 +136,13 @@ open class ThreadPool(
override fun shutdown() {
state = ThreadPoolStates.STOPPING
synchronized(threads) {
for (thread in threads.toSynchronizedList()) {
if (thread.state == Thread.State.TIMED_WAITING) {
thread.interrupt()
}
}
}
while (threads.isNotEmpty()) {
Thread.sleep(1L)
}