[K/N][Runtime] Switch thread states in termination handlers

This commit is contained in:
Ilya Matveev
2021-07-19 20:14:14 +07:00
committed by Space
parent a1f6c70355
commit 99bd26c2ef
15 changed files with 536 additions and 126 deletions
@@ -5,6 +5,7 @@
import kotlin.test.*
import kotlin.native.concurrent.*
import kotlin.native.internal.*
fun mainLegacyMM() {
assertFailsWith<InvalidMutabilityException> {
@@ -12,8 +13,8 @@ fun mainLegacyMM() {
}
val x = 42
val old = setUnhandledExceptionHook({
throwable: Throwable -> println("value $x: ${throwable::class.simpleName}")
val old = setUnhandledExceptionHook({ throwable: Throwable ->
println("value $x: ${throwable::class.simpleName}. Runnable state: ${Debugging.isThreadStateRunnable}")
}.freeze())
assertNull(old)
@@ -26,8 +27,8 @@ fun mainExperimentalMM() {
assertNull(unset)
val x = 42
val old = setUnhandledExceptionHook {
throwable: Throwable -> println("value $x: ${throwable::class.simpleName}")
val old = setUnhandledExceptionHook { throwable: Throwable ->
println("value $x: ${throwable::class.simpleName}. Runnable state: ${Debugging.isThreadStateRunnable}")
}
assertNotNull(old)