Kotlin coroutines are using thread pools in backgr...
# coroutines
b
Kotlin coroutines are using thread pools in background. How does coroutine can start executing in one thread, suspend execution, and resume on a different thread?
z
Coroutines are just fancy callbacks. The
CoroutineDispatcher
is responsible for invoking the callbacks, and it can invoke them on whatever thread it wants.
Like if you pass a callback to a Java API that uses `Executor`s. The
Executor
could decide to invoke the callback immediately, or schedule it to run on a different thread.
☝️ 2