$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin Coroutines
Search
Rygel Louv
November 14, 2020
Programming
0
57
Kotlin Coroutines
Introduction to Kotlin Coroutines. We went through the basic concepts of Coroutines.
Rygel Louv
November 14, 2020
Tweet
Share
More Decks by Rygel Louv
See All by Rygel Louv
Model Context Protocol: Connecting AI Models to the Real World
rygelouv
0
28
Exploring Mobile Release Management: Strategies and Best Practices
rygelouv
0
190
State Machines and How they Shape Mobile Architectures
rygelouv
0
200
Feature Flags for Mobile Development
rygelouv
0
210
Build and Publish an Open Source Android Library for Fun and Non profit
rygelouv
1
130
Kotlin "by" Delegation
rygelouv
0
96
Introduction to Type-Safe Builders: create a DSL in Kotlin
rygelouv
0
240
Annotation processing: generate code, eliminate boilerplate
rygelouv
0
140
Other Decks in Programming
See All in Programming
AIコーディングエージェント(Manus)
kondai24
0
200
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.4k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.5k
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
370
AIコーディングエージェント(NotebookLM)
kondai24
0
210
Deno Tunnel を使ってみた話
kamekyame
0
190
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
110
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
240
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
2
220
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
87
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Believing is Seeing
oripsolob
0
12
SEO for Brand Visibility & Recognition
aleyda
0
4.1k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
47
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
130
Testing 201, or: Great Expectations
jmmastey
46
7.8k
KATA
mclloyd
PRO
33
15k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.3k
Amusing Abliteration
ianozsvald
0
63
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
120
Transcript
Kotlin Coroutines Rygel Louv Dakar Ruby Brigade.
2019 Rygel Louv Software engineer
- Simplifying asynchronous programming - Write async code that looks
like sync code Coroutines: what problem do they solve ? P . 3
Synchronous blocking code P . 3
Synchronous blocking code P . 3
Async code using a callback P . 3
Callback Hell P . 3
Coroutines are the best of both worlds P . 3
Coroutines create a callback under the hood called Continuation P
. 3 Callback
State Machine and Continuation Passing Style P . 3
What is a coroutine ? P . 3 - Not
a thread - Takes a piece of code and run it in a thread - Lightweight thread
- Context switching: withContext - Dispatchers Coroutines concepts P .
3
- Dispatcher.Main: Main thread - Dispatcher.IO: Network and disk -
Dispatcher.Default: CPU (heavy computation) Coroutines dispatchers P . 3
- Canceling coroutine execution - Following a Lifecycle - Informing
components when Exception happens Coroutines concepts: Structured concurrency P . 3 Avoid memory leaks
- Keep track of coroutines - Ability to cancel them
- Is notified of failures Structure concurrency: Scopes P . 3
Coroutine scope: launching coroutines P . 3
P . 3 Coroutine scope: launching coroutines
P . 3 Coroutine scope: launching coroutines Parent Child Scope
will get all exceptions thrown by this function
- Cancels all coroutines - Can not start more coroutines
Scopes: cancelation P . 3
Suspend function in a coroutine P . 3
- When a child fails, the scope get notified -
Then the scope cancel itself and cancel all children Scopes exception handling: Job P . 3
- The failure of one child does not affect other
children - When the scope get notified of a failure, nothing happens Scopes exception handling: SupervisorJob P . 3
Creating coroutines P . 3
Creating coroutines: Launch P . 3 - Creates a new
coroutine - Fire and forget
Creating coroutines: Async P . 3 - Creates a new
coroutine - Returns a value Deferred == Promise/Future
P . 3
Cancellation requires co-operation P . 3
Cancellation require co-operation P . 3 - Check if coroutine
is Active
Next on coroutines P . 3 - Dive deeper in
Continuation Passing Style - More on co-operation - Channels - Flows
P . 27 THANK YOU