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

Robert Menke

10/02/2019, 12:54 AM
Are there any articles out there that compare coroutines to Apple’s Grand Central Dispatch (GCD)? Curious to read up on comparisons between the two.
b

basher

10/02/2019, 1:23 AM
I haven't seen any. They're both lambda-based abstractions for managing async work (background and main thread). The main difference for an app dev is that coroutines + suspend funs give you structured concurrency, which you don't get with GCD. For example, ensuring async work is complete in your tests in the GCD world is a chore. In coroutines, it's all done (for the most part assuming all parties aren't doing things low GlobalScope.launch) when runBlocking completes in your test
👍 2
That's the short version I think
r

Robert Menke

10/02/2019, 6:35 PM
Awesome thanks @basher!
4 Views