F
F
foonfyrick2021-03-29 14:50:24
Kotlin
foonfyrick, 2021-03-29 14:50:24

Coroutines, Runnable, DispatchedContinuation?

Lines from the article:
In addition, DispatchedContinuation inherits from the abstract class DispatchedTask, which, in the Java programming language implementation, is a type that implements the Runnable interface. Therefore, DispatchedContinuation can run on a thread! Isn't that cool? When a CoroutineDispatcher is specified, the coroutine is converted to a DispatchedTask, which is dispatched to be executed on the thread as a Runnable!

I don't see that it implements the Runnable interface, or is it just java? It implements SchedulerTask().
And it does have a run() method, but it doesn't look much like the run() method from the Runnable interface.

And in general, these lines are definitely reliable? That is, if I specify Dispatcher in CoroutineScope, then the coroutine is converted to DispatcherTask and executed in Runnable, and if I specify only CoroutineName instead of the dispatcher, what then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-03-29
@foonfyrick

DispatchedTask: SchedulerTask
SchedulerTask = Task
Task: Runnable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question