abstract fun restoreThreadContext(context: CoroutineContext, oldState: S)

Restores context of the current thread. This function is invoked after the coroutine in the specified context is suspended in the current thread if updateThreadContext was previously invoked on resume of this coroutine. The value of oldState is the result of the previous invocation of updateThreadContext and it should be restored in the thread-local state by this function. This method should handle its own exceptions and do not rethrow it. Thrown exceptions will leave coroutine which context is updated in an undefined state and may crash an application.



the coroutine context.


the value returned by the previous invocation of updateThreadContext.


Link copied to clipboard