if you have some normal function / code, is there a way to tell if your in a coroutine, or just a normal code path? For logging, I'd like to add the coroutine name (if it exits). but logging calls can be called from anywhere, inside or outside of coroutines.
Apparently no simple solution besides using thread local
t
TwoClocks
07/28/2021, 7:30 PM
I don't understand. coroutine to threads is a M:N mapping. How does using thread local help?
TwoClocks
07/28/2021, 7:30 PM
except in the case where 1 coroutine = 1 thread? In which case why use coroutines at all?
m
mbonnin
07/28/2021, 9:50 PM
Yea agreed, I don't understand either 😕
t
TwoClocks
07/30/2021, 12:23 AM
actually, since I'm using my own dispatcher, and coroutineContext it's actually pretty simple to update ThreadLocal any time a dispatch/resume a coroutine.... but only because I have my own executetor...