kotlinx.coroutines icon indicating copy to clipboard operation
kotlinx.coroutines copied to clipboard

A prototype of ThreadContextElement on k/js and k/native

Open eymar opened this issue 3 years ago • 0 comments
trafficstars

It's a mere copy/paste from jvm sources + 2 common tests to showcase how ThreadContextElement can be used (similar to Compose Runtime needs).

It's desirable to have some common CoroutineContext.Element similar to ThreadContextElement:

Specifically, such a CoroutineContext.Element would have 2 common things with ThreadContextElement: a function e.g. onResume(context: CoroutineContext): S, which is invoked before the coroutine in the specified context is resumed a function e.g. onSuspend(context: CoroutineContext, oldState: S), which is invoked after the coroutine in the specified context is suspended

eymar avatar Jun 17 '22 10:06 eymar