do not click

Meeting C++ 2026   |  Online   |  Training   |  Books   |  Survey   |  Job fair   |  Advertising   |  Jobposting   |  Login

Meeting C++ 2026 - Coroutines (wonder)land

Conference | Live Schedule | Talks | Get your ticket | Slides | Set your timezone

Coroutines (wonder)land

Join session

Damir Ljubic

On Day 3 at 9:00 (CET/Berlin) in Track D online

I’ll give a practical example of using coroutines in socket-based communication.

The precondition: I've developed the fully functional library for the purpose of my book: "Infotainment Development on Android".

We will redesign the receiver component, common for both endpoints – for handling the data exchange.

We will start with naïve approach – trying directly to replace existing code with coroutine and explain why this is

an antipattern. Then we will redesign the receiver to be coroutines “friendly” and how we can reimplement

the Server and Client components – to handle multiple connections within a single thread, instead of having one receiver

thread per connection.

Then, we will also try to employ a new asynchronous mechanism introduced with C++26: Sender/Receiver library and executors, to see how we can leverage this to reimplement the receiver part and compare it with previous solutions.

We will also explore how we can employ custom allocators to override the coroutine default allocation strategy – allocation on the heap.

I’ll describe the implementation, starting with the fixed-size stack allocator – as internal memory storage on the stack, and how to build the pool of fixed-size allocators of different sizes on top of it. We will wrap this implementation into

std::pmr::memory_resource interface to have polymorphic, type-erased allocator that can be used in most generic way - along with std::pmr containers. We will use it to override the coroutine default allocation strategy, allocating memory primarily on the stack, with fallback strategy – allocating on the heap, only when the capacity of the internal stack storage is exhausted.

Please login to comment

Copyright Meetingcpp GmbH Imprint Privacy Policy