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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
The free-lunch guide to idea circularity
hollycummins
0
320
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
230
Rethinking API Platform Filters
vinceamstoutz
0
140
Ruby and LLM Ecosystem 2nd
koic
1
1.2k
安いハードウェアでVulkan
fadis
0
740
PHPで TLSのプロトコルを実装してみる
higaki_program
0
390
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
230
Claude Code Skill入門
mayahoney
0
420
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
270
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
550
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
160
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Navigating Team Friction
lara
192
16k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
Discover your Explorer Soul
emna__ayadi
2
1.1k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
980
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Believing is Seeing
oripsolob
1
93
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
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