~/talk

Combine Lambdas and weak_ptrs to make concurrency easy

Talkat CppCon 2016 · 2016-09-18..09-23· [c-and-cpp]
links:none on file
slides:none on file

Combining lambdas with shared_ptr and weak_ptr makes deferred thread dispatch simple by capturing a weak_ptr, checking weak_ptr.lock() before running, and dispatching the lambda to the simulation or network thread so no manual lifetime tracking is needed. Use make_shared for efficiency and consider scope guard for cleanup and exception safety. Example: schedule work 10ms–100ms later or add random 1ms delays to simulate latency that successfully turned a single player prototype into a multiplayer test.

AI-written summary · about

  1. 0:00Intro
  2. 0:15What are shared pointers
  3. 1:30Combine
  4. 2:08Invoke
  5. 2:46Use case
~/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.