I'm wondering , how does the Kotlin co-routines actually work on an android device? I know it doesnt use threads , so what does it use?
there's an example with 100 thousand co-routines being run simultaneously which is pretty cool , compared to the old threads
m
miha-x64
03/01/2017, 3:14 PM
adibfara: it’s impossible to avoid using threads in Java 🙂. coroutines just does not spawn new ones.
a
adibfara
03/01/2017, 3:15 PM
like a thread pool?
m
miha-x64
03/01/2017, 3:17 PM
AFAIK, it depends on library’s choice and it’s possible to use Java’s threadPoolExecutors, Android’s handlerThreads, and whatever.
e
elizarov
03/01/2017, 3:17 PM
You can run 100k coroutines in the same thread. When one coroutine suspends, the thread is available for other coroutines. You can join #C1CFAFJSK for further discussion
k
konsoletyper
03/01/2017, 3:18 PM
Coroutines are special functions which can be suspended during execution. "Suspended" means they stop working and dump their state somewhere. Later, you can restore their state and continue execution.
a
adibfara
03/01/2017, 3:19 PM
Thanks everyone , #C1CFAFJSK seem a good place for this kind of discussion