Thanks for your reading, please give me a STAR!
(Brian Goetz - Java concurrency: Publisher: Addison-Wesley Professional, Year: 2006; 2013)
A coroutine is Kotlin's way of tackling asynchronous operations, multi-threaded programming
or manging concurrency.
According to Coroutine Team, Java threads have below problems:
- Context switching for thread can be a costly operation;
- Various the various OS does restrict the number of threads created by per app. They can
be infinite; - There are still a few platforms that do not support threads (JavaScript);
- It's always difficult to debug threads;
- Dealing with race conditions can be a nightmare.
Kotlin v1.6, IntelliJ IDEA Education Edition, JDK 1.8
- Anko-Coroutines: https://github.com/Kotlin/anko/wiki/Anko-Coroutines