~/talk

Coroutines are Qt: safer thread pools interactions

Talkat NDC TechTown 2020 · 2020-08-31..09-03· [c-and-cpp]
links:none on file
links:none on file
slides:none on file

A C++20 coroutine-based pattern replaces nested callbacks with a sequential function that bounces between main thread and thread-pool using C++20 coroutines and self-dispatching awaitables. It auto-checks lifetimes by wrapping UI pointers in a guarded UI pointers tuple that nulls them on worker switch, and protects backend access with an expiring backend pointer. Implemented in portable C++ (works with Qt), tests pass and expose deterministic crashes for race bugs; tradeoffs: heap allocation and swap overhead, and compiler/debugger support is still immature.

AI-written summary · about

  1. 0:00Intro
  2. 1:01Outline
  3. 2:28Motivation - The Ping-Pong Pattern
  4. 5:40Challenges
  5. 8:12Running Example: Remarks
  6. 8:47Approach 1 - The Qt Way: Qobjects
  7. 13:27Approach 2 - Nested Lambdas
  8. 15:57Other Approaches
  9. 16:44Coroutines - High-Level Overview
  10. 17:30Coroutines - Supported Operations
  11. 20:38Coroutines - Pseudo-Code
  12. 22:59Coroutines in C++
  13. 24:49C++ Coroutines - Notable Objects
  14. 26:16C++ Coroutines - New Coroutine Operator
  15. 27:22C++ Coroutines - Practical Example
  16. 30:28C++ Coroutines - Awaitable Interface
  17. 32:07C++ Coroutines - co_await on Awaitables
  18. 33:33Design Principles
  19. 34:03Proposed Solution - 4 Incremental Steps
  20. 35:33Self-Dispatching Coroutines - Custom Await
  21. 36:15Self-Dispatching Coroutines - Running Exa
  22. 37:19Self-Dispatching Coroutines - Recap
  23. 37:56Automate Lifetime Checks - Problem State
  24. 38:44Automate Lifetime Checks - Example of Desir
  25. 39:21Automate Lifetime Checks - Guard clas
  26. 40:17Automate Lifetime Checks - Checked Await
  27. 41:03Automate Lifetime Checks - Running Exar
  28. 42:022. Automate Lifetime Checks - Recap
  29. 42:21Guarding Thread-Unsafe Pointers - Fronten
  30. 42:56Guarding Thread-Unsafe Pointers - Improved
  31. 43:31Guarding Thread-Unsafe Pointers - Swapp
  32. 44:07Guarding Thread-Unsafe Pointers - Rec
  33. 44:25Guarding Thread-Unsafe Pointers - Backen
  34. 44:46Guarding Thread-Unsafe Pointers - Running
  35. 45:34Guarding Thread-Unsafe Pointers - Expirit
  36. 45:55Guarding Thread-Unsafe Pointers - ToThrea
  37. 46:35Final Reworked Example
  38. 47:34Final Design - Remarks
  39. 50:19Hidden Costs
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.