~/talk

Here’s my number; call me, maybe. Callbacks in a multithreaded world

Talkat ACCU 2019 · 2019-04-10..04-13· [concurrency, c-and-cpp]
slides:none on file

Describes concrete fixes for callback chaos in task-based C++: use executors/thread pools, never invoke user code while holding a mutex, and queue callbacks to a single worker to preserve order and allow safe unregistering. Prefer capture by value not reference to avoid dangling references, use shared_ptr ownership (weak_ptr creates subtle races where destruction can run on a worker thread), and signal shutdown with stop_source/stop_token (P0660) or a task counter wrapper that waits until active tasks reach zero before destroying resources.

AI-written summary · about

  1. 0:00Intro
  2. 0:15Overview
  3. 0:57Tossbased programming
  4. 3:46Executors
  5. 6:32Callbacks
  6. 7:53Race Conditions
  7. 8:50Base Conditions
  8. 10:11Multithreaded code
  9. 11:48First solution
  10. 12:34Downsides
  11. 15:37Queue
  12. 22:04Lifetime issues
  13. 22:26A simple example
  14. 24:04Valuebased programming
  15. 25:28Reference
  16. 26:37Watch for problems
  17. 29:50Data object
  18. 31:17Hanging tasks
  19. 32:17Weak pointer
  20. 35:32Stop sauce
  21. 36:32Stop request
  22. 38:11Stop callback
  23. 48:08Guidelines
  24. 51:02Alternatives
~/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.