How do you get root coroutine context? Or can you ...
# coroutines
r
How do you get root coroutine context? Or can you walk through parent contexts?
z
You can definitely traverse the job hierarchy. What are you trying to use this for?
r
@Zach Klippenstein (he/him) [MOD] I'm trying to do some automatic profiling of things with coroutines. I want to only profile the timing of the root coroutine though
I'd like to give each root coroutine a unique name. However when using Coroutine context to do something like this... It doesn't work so well because context is propagated.
z
yea, you can’t mutate contexts, but you could add completion listeners. i think you’d also need to use reflection to get access to the job’s parent, there’s no public API for that.