do not click

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

Meeting C++ Trainings listing

All trainings default to the Berlin (Germany) timezone

Structured Concurrency in C++: A Hands-On Workshop (Coroutines + Senders/Receivers)

Mateusz Pusz

This is an online training

24.03.2025 for 2 day(s)

visit the ticketshop

Trainings Details

Today, C++ software is increasingly asynchronous and parallel, a trend that is likely to continue. While the C++ Standard Library has a rich set of concurrency primitives and lower-level building blocks, we lack a standard framework for asynchrony and parallelism that C++ programmers desperately need.

Asynchrony and parallelism appear everywhere, from processor hardware interfaces to networking, file I/O, GUIs, and accelerators. Every C++ domain and every platform needs to deal with them, from scientific computing to video games to financial services, from the smallest mobile devices to your laptop to GPUs in the world's fastest supercomputer.

This training shows that concurrency is not only about the C++ Standard Library threading and synchronization low-level tools. During the workshop, you will learn how to write efficient, asynchronous, and highly concurrent code without the need for any manual synchronization between threads, leading to simpler code and faster runtimes. During the hands-on exercises, you will implement coroutine tools from scratch and create parallel processing pipelines with a new `std::execution` framework, also called Senders/Receivers, which will arrive as a part of C++26. The reference implementation of this framework is publicly available on GitHub so that it can be used in production immediately without the need to wait for the next C++ release.

## What You Will Learn?

- Understand what structured concurrency is and how it helps write thread-safe code without the need for additional synchronization.
- A detailed discussion of coroutine machinery and its suspend and customization points.
- How to implement synchronous and asynchronous tasks using coroutines.
- How to build a complex asynchronous pipeline with schedulers, senders, and receivers in a few lines of code.
- Practical usage of all the asynchronous algorithms provided by the `std::execution` framework.

## Workshop Structure

- 30% lecture
- 70% hands-on coding

## Experience required

- Recent working experience with writing simple C++ templates

## Environment

- A laptop with a web browser and access to the Internet
- All hands-on exercises will be implemented using [Compiler Explorer](https://godbolt.org/)

Trainings Agenda

1. Asynchronous Programming with Coroutines

- Coroutine keywords, restrictions, suspend points
- Coroutine return type
- std::coroutine_traits
- Coroutine promise interface
- std::coroutine_handle
- Awaiters and Awaitables
- Symmetric Control Transfer
- C++ exceptions support
- Eager and Lazy Tasks
- async with coroutines
- sync_await

2. Structured Concurrency with Senders and Receivers

- Motivation
- The structure of an asynchronous processing pipeline
- Data parallelism with senders
- Cancellation support
- Transferring the work
- Sender factories
- Sender adaptors
- Sender consumers
- Implementing an asynchronous algorithm
- Sender/Receivers and Coroutines


Get your ticket now

Number of attendees is limited, please get your spot early.

Important: please register attendees with THEIR email, important details are shared by email.

visit the ticketshop

Copyright Meetingcpp GmbH Imprint Privacy Policy