https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

ait

07/18/2017, 7:40 PM
Hi! I can not figure out how to implement method of 3rd party interface as suspendable when I know that I will call it in suspendable context. What I need is some way to access CoroutineScope of running coroutine (I have some useful data in there) Any hints? I imagine something like ThreadLocal but did not find anything in API.
f

fred.deschenes

07/18/2017, 7:51 PM
I guess you'll have to write your own CoroutineDispatcher, from the dispatch method you have access to both the CoroutineContext and the Runnable block to execute, so I guess you could set your ThreadLocal from there
3 Views