My tutorial and take on C++20 coroutines
Over the last 25 years, I’ve written a lot of event-driven code in C++. A typical example of event-driven code is registering a callback that gets invoked every time a socket has data to be read. Once you have read an entire message, possibly after many invocations, you parse the message and invoke another callback from a higher layer of abstraction, and so forth. This kind of code is painful to write because you have to break your code up into a bunch of different functions that, because they are different functions, don’t share local variables. As an example, here’s a subset of the methods on the smtpd class of Mail Avenger, my SMTP server written in C++03: Step 1, cmd_rcpt, seems like a reasonable function, called in response to a client issuing an SMTP “RCPT” command. Processing the RCPT command depends on certain information being cached about the client. If the information if not cached, it launches an asynchronous task to probe the client and returns. The asynchronous task, when
My tutorial and take on C++20 coroutines ←Index View as PDF Introduction Over the last 25 years, I’ve written a lot of event-driven code in C++. A typical example of event-driven code is registering a callback that gets invoked every time a socket has data to be read. Once you have read an entire message, possibly after many invocations, you parse the message and invoke another callback from a higher layer of abstraction, and so forth. This kind of code is painful to write because you have to break your code up into a bunch of different functions that, because they are different functions, don
saved by
related reading
- Daily bit(e) of C++ | Coroutines: step by stepsimontoth.substack.com
- A half-hour to learn Rustfasterthanli.me
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- Learn C++ – Skill up with our free tutorialslearncpp.com
- (Quite) A Few Words About Asyncyoric.github.io
- TypeScript Structured Concurrencythecandidstartup.org
- What Async Promised and What it Delivered — Causalitycausality.blog
- Three Ways For C++ Thread Synchronization in C++11 and C++14 | Chrizogchrizog.com
- Designing a Concurrent Application | Learn You Some Erlang for Great Good!learnyousomeerlang.com
- Effortless Performance Improvements in C++ | Julien Jorge's Personal Websitejulien.jorge.st
- Multi Core Programming and Threadsimomath.com
- CppCon 2019: Arthur O'Dwyer “Back to Basics: Smart Pointers”youtube.com