https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

Rohan Maity

12/07/2018, 4:38 AM
Limit-Breaker: I was Reading about Coroutines in Kotlin "Kotlin coroutines are stackless , they don't have their own stack" "Threads are managed by OS and Coroutines managed by Users " What does this mean ? How Kotlin coroutines manages to unblock thread while suspending the functions ?
b

bdawg.io

12/07/2018, 6:06 AM
How Kotlin coroutines manages to unblock thread while suspending the functions ?
You just described how it manages to do it. Because the function has suspended (aka returning a special value that means the function is not done yet), the coroutines dispatcher is then able to execute a different function on that thread
d

Dico

12/07/2018, 2:42 PM
Kotlin coroutines are not blocking threads when they suspend. Under the hood, it uses a kind of callback system.
2 Views