Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

NDC Conferences

Coroutines are Qt - Safer Thread Pools Interactions

NDC Conferences via YouTube

Overview

Explore coroutines in Qt for safer thread pool interactions in this 52-minute conference talk. Learn how to solve common problems in asynchronous applications by offloading tasks to worker threads. Discover techniques to improve code readability, prevent race conditions, and handle object lifetimes effectively. Gain insights into using C++ 20 coroutines to write sequential syntax for asynchronous code, automatically migrate execution between threads, guard against race conditions, and ensure result storage validity. Follow along with a real-world Qt-based example and learn design principles for implementing coroutines in GUI applications. Understand the challenges of the ping-pong pattern and compare different approaches, including Qt's QObjects and nested lambdas. Dive into coroutine concepts, operations, and practical implementations in C++. Explore incremental steps to create a robust solution for thread pool interactions, including self-dispatching coroutines, automated lifetime checks, and guarding thread-unsafe pointers.

Syllabus

Intro
Outline
Motivation - The Ping-Pong Pattern
Challenges
Running Example: Remarks
Approach 1 - The Qt Way: Qobjects
Approach 2 - Nested Lambdas
Other Approaches
Coroutines - High-Level Overview
Coroutines - Supported Operations
Coroutines - Pseudo-Code
Coroutines in C++
C++ Coroutines - Notable Objects
C++ Coroutines - New Coroutine Operator
C++ Coroutines - Practical Example
C++ Coroutines - Awaitable Interface
C++ Coroutines - co_await on Awaitables
Design Principles
Proposed Solution - 4 Incremental Steps
Self-Dispatching Coroutines - Custom Await
Self-Dispatching Coroutines - Running Exa
Self-Dispatching Coroutines - Recap
Automate Lifetime Checks - Problem State
Automate Lifetime Checks - Example of Desir
Automate Lifetime Checks - Guard clas
Automate Lifetime Checks - Checked Await
Automate Lifetime Checks - Running Exar
2. Automate Lifetime Checks - Recap
Guarding Thread-Unsafe Pointers - Fronten
Guarding Thread-Unsafe Pointers - Improved
Guarding Thread-Unsafe Pointers - Swapp
Guarding Thread-Unsafe Pointers - Rec
Guarding Thread-Unsafe Pointers - Backen
Guarding Thread-Unsafe Pointers - Running
Guarding Thread-Unsafe Pointers - Expirit
Guarding Thread-Unsafe Pointers - ToThrea
Final Reworked Example
Final Design - Remarks
Hidden Costs

Taught by

NDC Conferences

Reviews

Start your review of Coroutines are Qt - Safer Thread Pools Interactions

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.