Real-time Safety — Guaranteed by the Compiler!
summary
Claim: compile-time guarantees for real-time safety via Clang 20 Function Effect Analysis plus the runtime checker RealtimeSanitizer. Demonstrations show marking functions as non-blocking attribute or non-allocating, transitive enforcement, and compiler inference for headers/templates. Reality checks: third‑party libraries need ignored-wrappers or redeclarations and realtime sanitizer catches lied‑about libs. Practical build: Squarehead refactors an audio pipeline toward harder real‑time, implements a custom non-blocking_function to avoid std::function type‑erasure allocations, and reports the approach works in CI and on hardware.
AI-written summary · about
chapters (26)
- 0:00Real-time safety intro
- 1:04Who writes real-time code
- 2:25Defining real-time code
- 4:33Real-time vs performance
- 5:57Avoiding real-time hazards
- 8:07Function effect analysis
- 12:23Performance annotations
- 15:11Non-allocating compile checks
- 17:17Function effects transitivity
- 20:06Exceptions and allocations
- 22:55Inheritance stricter guarantees
- 24:42Non-blocking hierarchy
- 26:32Why non-blocking everywhere
- 28:04Noexcept vs real-time safety
- 30:30Compiler lessons learned
- 32:37Conditional compilation
- 34:01Third-party code warnings
- 37:31Real-time sanitizer
- 39:17Lambdas in real-time
- 43:10Callbacks and templates
- 46:23std::function pitfalls
- 50:18Non-blocking wrapper
- 52:42Templatize non-blocking
- 54:07Real-time code tips
- 57:17Summary
- 57:37Q&A
related talks
54mCatching Real-time Safety Violations in C++
01h 00mStatic Analysis and Program Safety in C++: Making it Real
01h 06mmemory-safe C++
01h 26mA Path to Practically Safe C++
01h 12mFinding Bugs with Clang at Compile and Run Time
01h 03mLifetime Safety in C++: Past, Present and Future
32mVerifying Constant-Time Implementations
01h 02mModern C++ Safety and Security At 20
