I'm implementing a custom `CoroutineDispatcher` th...
# coroutines
a
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
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
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