Saturday 9 July 2022

What are coroutines in Kotlin?

Coroutines in Kotlin are like threads, but not quite like threads. They allow asynchronous computing. 

Their functionality is brought to bear from the library kotlinx.coroutines, developed by JetBrains

Put simply, a coroutine in Kotlin is a unit of suspendable computation Such a computation may be suspended in one thread, then reawoken in another thread. The keyword launch is used to launch a coroutine, and delay suspends the coroutine for a period of time, but does not hog the underlying thread.

No comments: