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
Rygel Louv
November 14, 2020
Programming
0
64
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
Leading Beyond Titles: Mobile Engineering Leadership from Both Sides of the Table
rygelouv
0
28
Model Context Protocol: Connecting AI Models to the Real World
rygelouv
0
39
Exploring Mobile Release Management: Strategies and Best Practices
rygelouv
0
220
State Machines and How they Shape Mobile Architectures
rygelouv
0
220
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
250
Annotation processing: generate code, eliminate boilerplate
rygelouv
0
150
Other Decks in Programming
See All in Programming
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2k
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.3k
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
410
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
210
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
620
へんな働き方
yusukebe
5
2.8k
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1k
『Kubernetes ☸️ で実践する Platform Engineering 』を最高速度で読み抜いたる!!👊🏻
hiroki_hasegawa
0
100
CSC307 Lecture 15
javiergs
PRO
0
260
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
260
AI 開発合宿を通して得た学び
niftycorp
PRO
0
160
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
130
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
640
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
180
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
74
How to build a perfect <img>
jonoalderson
1
5.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
790
Raft: Consensus for Rubyists
vanstee
141
7.4k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
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