Asynchrony and Coroutines
summary
Claims that any asynchronous flow can be written in synchronous style by using coroutines implemented on Boost.Context and Boost.Coroutine, with concrete patterns: def/proceed to avoid race conditions, teleport/portal to move coroutines between thread‑pool schedulers, and alone (strand) for serialized nonblocking access. Provides a working server prototype, scheduler and wrapper code, measures performance roughly comparable to native async, avoids futures, and reports exception‑friendly low‑level context switching without copying large stacks.
AI-written summary · about
chapters (25)
- 0:00Intro
- 0:39Agenda
- 1:55Synchronous Multithreaded Server
- 5:10Real Asynchronous Server
- 5:35Asynchronous Server: Discussion
- 7:57Challenge
- 9:55Coroutines Implementation
- 10:31boost.context
- 12:50Coroutine Usage Convert asynchronous invocation: async(completionCallback)
- 13:46Coroutine Usage: Sequence Diagram
- 14:54Problem: Race Condition
- 15:43Possible solutions
- 16:12Solution: defer
- 17:24Usage: defer
- 18:41Synca Server
- 19:58Thread Pool
- 20:40Coroutine Wrapper struct Journey void de fer (Handler handler)
- 21:54Teleportation Let's jump to another scheduler
- 23:21Teleportation: Sequence Diagram
- 24:23Portal Portal is bidirectional teleportation: struct Portal
- 24:57Portal Usage struct Network
- 27:25Alone
- 28:59Integral Example: Initialization
- 30:57Integral Example: Task string obtainvalue(const string key)
- 33:11Theorem Any asynchronous task can be implemented by using coroutines
related talks
01h 05mWhy use coroutines for asynchronous applications
53mC++ Coroutines and Structured Concurrency in Practice
57m[filtered] Asynchronous C++ Programming
54mAsynchronous IO Using Boost.Asio
01h 02mC++20’s Coroutines for Beginners
31mCoroutine Patterns: Problems and Solutions Using Coroutines in a Modern Codebase
55mC++20 coroutines as an API principle
18mA better way of doing Async Rust
