Effect handlers for C via coroutines
summary
libseff implements effect handlers for C by representing pending computations as mutable coroutines and dispatching on reified operations (no closures), exposing a perform macro and coroutine_new/resume that takes a bitset of handleable ops. It uses segmented stacks with segment recycling so stacks remain stable and stack pointers into locals are safe, limits to 64 effect tags (numeric), and offers thread‑safe coroutines. Benchmarks run 20 million commands across deep handler stacks and a work‑stealing async scheduler plus an HTTP server show performance competitive with libhandler/libmp and surprisingly close to hyper.
AI-written summary · about
chapters (12)
- 0:00Effect handlers in C
- 1:05Bringing effect handlers to C
- 3:14Constraints for embedded C
- 5:25Limitations of libraries
- 6:47Handled coroutines solution
- 7:49Defining effects in libf
- 10:20Effects with coroutines
- 13:30Coroutine API overview
- 14:32Stack handling
- 16:21Performance benchmarks
- 17:49Conclusion and future
- 18:53Q&A
related talks
01h 16mConcurrency Approaches: Past, Present, and Future
52mCoroutines: C++ vs Rust
01h 24mEasy Senders/Receivers
01h 05mCoroutines: C++ vs Rust
57mCoroutine Intuition in C++
01h 27mManage Asynchronous Control Flow With C++ Coroutines
47mHow to start using coroutines
01h 08mImplementation of a multithreaded compile-time ECS in C++14
