Asynchronous Programming in C++ - Structured Concurrency

Course objectives

After completing this course you will be able to:

  • identify the limitations of std::thread and std::future
  • use coroutines to implement asynchronous tasks
  • design asynchronous algorithms according to the Structured Concurrency paradigm
  • build complex asynchronous pipelines using standard Sender adaptors
  • implement error handling and task cancellation in asynchronous workflows
  • leverage std::task from C++26 for seamless coroutine-based execution

Course syllabus

Evolution of Asynchrony in C++ (from C++11 to C++26)

  • Problems with the Classical Approach
    • Limitations of std::thread, std::future and std::promise
    • Resource management in callback-based implementations
  • Coroutines in C++20
  • Structured Concurrency in C++26 – Senders/Receivers

Coroutines

  • Coroutines as a Generalization of Functions
  • Coroutine Mechanics in C++
    • Suspension points – co_await
    • Coroutine return types
    • The promise_type interface
    • Coroutine handle – std::coroutine_handle
  • Awaiters & Awaitables
  • Creating Custom Task Types
    • Implementing Task and Generator types
  • Symmetric Transfer

Senders/Receivers – std::execution

  • The Three Pillars of Abstraction:
    • Schedulers – managing execution time and context (thread pools, GPU, execution contexts)
    • Senders – describing asynchronous operations (lazy evaluation)
    • Receivers – handling results, errors, or cancellation
  • Composition of Asynchronous Operations
    • Building pipelines using adapters
    • Asynchronous algorithms
  • Cancellation of Asynchronous Operations
  • Error Handling in Asynchronous Algorithms
  • Integration with Coroutines – std::task
    • Awaitable Senders

Prerequisites

Attendance of our Multithreading in C++ course or equivalent experience with C++

Course duration

3 days, 8 class hours each
On-site course quote

In-house training course.

Run at your company premises.

Get a quote
On-line course quote

In-house training course.

Delivered live in a virtual classroom.

Get a quote
Upcoming public courses

No scheduled dates available for this course?

Request a course