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

kevin.cianfarini

11/20/2019, 10:17 PM
what is the entity responsible for resuming a coroutine? Is it a
Dispatcher
?
o

octylFractal

11/20/2019, 10:20 PM
technically, it can be anything that calls Continuation.resume
k

kevin.cianfarini

11/20/2019, 10:20 PM
For context, if I wanted to implement non blocking IO and wanted to implement a
kqueue
of sorts, would the polling thread be contained inside of a dispatcher? Or would the dispatcher
dispatch
to a worker thread which polls the queue and calls
Continuation.resume
from there?
this is a throught exercise currently
o

octylFractal

11/20/2019, 10:22 PM
commonly a ContinuationInterceptor (which a Dispatcher is) will intercept the resume call (by delegation pattern ) and redispatch it to the appropriate thread
the polling thread does not need to be in a Dispatcher itself
k

kevin.cianfarini

11/20/2019, 10:22 PM
perfect
thank you
4 Views