File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
core/kotlinx-coroutines-core Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ private class BlockingCoroutine<T>(
56
56
if (privateEventLoop) require(eventLoop is BlockingEventLoop)
57
57
}
58
58
59
- override fun onCancellationInternal(exceptionally: CompletedExceptionally? ) {
59
+ override fun onCompletionInternal(state: Any?, mode: Int ) {
60
60
// wake up blocked thread
61
61
if (Thread.currentThread() != blockedThread)
62
62
LockSupport.unpark(blockedThread)
Original file line number Diff line number Diff line change @@ -66,4 +66,20 @@ class RunBlockingTest : TestBase() {
66
66
finish(4)
67
67
thread.close()
68
68
}
69
+
70
+
71
+ @Test
72
+ fun testCancellation() {
73
+ val job = launch(DefaultDispatcher) {
74
+ runBlocking(coroutineContext) {
75
+ while(true) {
76
+ yield()
77
+ }
78
+ }
79
+ }
80
+
81
+ runBlocking {
82
+ job.cancelAndJoin()
83
+ }
84
+ }
69
85
}
You can’t perform that action at this time.
0 commit comments