Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin Coroutines
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Rygel Louv
November 14, 2020
Programming
66
0
Share
Kotlin Coroutines
Introduction to Kotlin Coroutines. We went through the basic concepts of Coroutines.
Rygel Louv
November 14, 2020
More Decks by Rygel Louv
See All by Rygel Louv
Leading Beyond Titles: Mobile Engineering Leadership from Both Sides of the Table
rygelouv
0
37
Model Context Protocol: Connecting AI Models to the Real World
rygelouv
0
44
Exploring Mobile Release Management: Strategies and Best Practices
rygelouv
0
230
State Machines and How they Shape Mobile Architectures
rygelouv
0
230
Feature Flags for Mobile Development
rygelouv
0
230
Build and Publish an Open Source Android Library for Fun and Non profit
rygelouv
1
150
Kotlin "by" Delegation
rygelouv
0
110
Introduction to Type-Safe Builders: create a DSL in Kotlin
rygelouv
0
260
Annotation processing: generate code, eliminate boilerplate
rygelouv
0
150
Other Decks in Programming
See All in Programming
GitHubCopilotCLIをはじめよう.pdf
htkym
0
270
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
380
Vibe NLP for Applied NLP
inesmontani
PRO
0
490
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
350
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
590
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
240
Swift Concurrency Type System
inamiy
1
550
エラー処理の温故知新 / history of error handling technic
ryotanakaya
6
1.6k
感情を設計する
ichimichi
5
1.6k
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.6k
🦞OpenClaw works with AWS
licux
1
260
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
180
Being A Developer After 40
akosma
91
590k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
680
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
200
Music & Morning Musume
bryan
47
7.2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
170
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.7k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
150
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