Skip to content

Commit 6fad018

Browse files
committed
Offload startCoroutineUnintercepted to separate thread to avoid races on completed deferred in StackTraceRecoveryTest
1 parent 3d2bf79 commit 6fad018

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kotlinx-coroutines-core/jvm/test/exceptions/StackTraceRecoveryTest.kt

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import kotlinx.coroutines.intrinsics.*
1010
import kotlinx.coroutines.selects.*
1111
import org.junit.Test
1212
import java.util.concurrent.*
13+
import kotlin.concurrent.*
1314
import kotlin.coroutines.*
1415
import kotlin.test.*
1516

@@ -292,10 +293,13 @@ class StackTraceRecoveryTest : TestBase() {
292293

293294
val barrier = CyclicBarrier(2)
294295
var exception: Throwable? = null
295-
await.startCoroutineUnintercepted(Continuation(EmptyCoroutineContext) {
296-
exception = it.exceptionOrNull()
297-
barrier.await()
298-
})
296+
297+
thread {
298+
await.startCoroutineUnintercepted(Continuation(EmptyCoroutineContext) {
299+
exception = it.exceptionOrNull()
300+
barrier.await()
301+
})
302+
}
299303

300304
barrier.await()
301305
val e = exception

0 commit comments

Comments
 (0)