File tree 1 file changed +9
-1
lines changed
kotlinx-coroutines-core/jvm/test
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,18 @@ class RejectedExecutionTest : TestBase() {
67
67
try {
68
68
withContext(Dispatchers .Default ) {
69
69
expect(3 )
70
+ assertDefaultDispatcherThread()
70
71
}
71
72
// cancelled on resume back
72
73
} finally {
74
+ expect(4 )
73
75
assertIoThread()
74
76
}
75
77
expectUnreached()
76
78
}
77
79
}
78
80
assertEquals(2 , executor.submittedTasks)
79
- finish(4 )
81
+ finish(5 )
80
82
}
81
83
82
84
@Test
@@ -135,6 +137,12 @@ class RejectedExecutionTest : TestBase() {
135
137
if (! thread.name.startsWith(threadName)) error(" Not an executor thread: $thread " )
136
138
}
137
139
140
+ private fun assertDefaultDispatcherThread () {
141
+ val thread = Thread .currentThread()
142
+ if (thread !is CoroutineScheduler .Worker ) error(" Not a thread from Dispatchers.Default: $thread " )
143
+ assertEquals(CoroutineScheduler .WorkerState .CPU_ACQUIRED , thread.state)
144
+ }
145
+
138
146
private fun assertIoThread () {
139
147
val thread = Thread .currentThread()
140
148
if (thread !is CoroutineScheduler .Worker ) error(" Not a thread from Dispatchers.IO: $thread " )
You can’t perform that action at this time.
0 commit comments