Chapter 03 — Deadline Propagation Across a Call Chain
Compute one deadline at the top of a call chain and pass that single time_point down through every hop, so no hop can silently extend the caller's budget.
The full source for this example lives in
examples/concurrency/03-timers-and-deadlines/— clone the repo,cdin, and./demo.sh.
Chapter reference: Doc 3 — Time, Timers, and Deadlines
What it shows
A runnable version of the chapter’s four-function call chain computes a deadline once at the top and passes the identical time_point through every hop, each of which checks it before doing any work. One mode injects an artificial, deadline-aware delay at a chosen hop and proves the caller’s total budget is never exceeded regardless of which hop is slow; a second mode calls a hop directly with an already-expired deadline and proves it returns immediately, with no work performed. A companion probe demonstrates that steady_clock::now() is a vDSO read under strace, while the one real sleep shows up as a kernel call — the chapter’s cost argument made observable.
Running it
cd examples/concurrency/03-timers-and-deadlines
./demo.sh # build + run deadline_chain/clockprobe + verify.lua
./demo.sh --clean # remove the image