updateThreadContext
Updates context of the current thread. This function is invoked before the coroutine in the specified context is resumed in the current thread when the context of the coroutine this element. The result of this function is the old value of the thread-local state that will be passed to restoreThreadContext. 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.
Parameters
context
the coroutine context.