We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 90fa892 commit bb22ae6Copy full SHA for bb22ae6
kotlinx-coroutines-core/jvm/src/CoroutineContext.kt
@@ -181,6 +181,14 @@ internal actual class UndispatchedCoroutine<in T>actual constructor (
181
*/
182
private var threadStateToRecover = ThreadLocal<Pair<CoroutineContext, Any?>>()
183
184
+ init {
185
+ // TODO explain this
186
+ if (uCont.context[ContinuationInterceptor] !is CoroutineDispatcher) {
187
+ val values = updateThreadContext(context, null)
188
+ threadStateToRecover.set(context to values)
189
+ }
190
191
+
192
fun saveThreadContext(context: CoroutineContext, oldValue: Any?) {
193
threadStateToRecover.set(context to oldValue)
194
}
0 commit comments