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

ansman

10/02/2020, 12:13 AM
I'm implementing a custom
CoroutineDispatcher
that is an immediate behavior. I noticed that
dispatchYield
is marked with
@InternalCoroutinesApi
. Can someone confirm that this is there to prevent people from calling the method, not implementing it? Reading the documentation it seems that this is meant for custom dispatchers to implement but that you should avoid calling it manually
e

elizarov

10/02/2020, 7:25 AM
It should be neither used nor implemented. It used to be used in the past internally by
UnconfiedDispatcher
, but it is not used anymore, so it could disappear from API at any time.
Double-checked. It is still used internally to ensure that when you
yield()
inside a
Dispatchers.Default
it is done in a fair way. But not used for "immediate" behavior anymore. For immediate behavior you just return
false
from
isDispatchNeeded
a

ansman

10/02/2020, 4:25 PM
Interesting. That's good to know
This is for AndroidX's PausingDispatcher
Ideally I would like to handle a regular dispatch and a yield dispatch differently
Right now we have a workaround but it's not ideal
7 Views