docs,examples: graceful shutdown — new examples/graceful_shutdown.rs, README 'Stopping actors', named_genserver uses shutdown(), Deep Dive terminate note, ROADMAP open items

This commit is contained in:
Claude (sandbox)
2026-08-19 16:28:42 +00:00
parent 6ceb138f5f
commit 849a424c8e
5 changed files with 179 additions and 1 deletions
+15
View File
@@ -272,6 +272,21 @@ outright — `join` what you need finished. No forcing sweep follows.
---
### Open items from the graceful-shutdown work (not scheduled)
- **gen_server / gen_statem as a direct supervised child.** A `ChildSpec` start
fn is `Fn()`, and `GenServerBuilder::start` spawns a *new* actor and hands
back a ref, so a supervised server today needs a trapping wrapper actor that
starts it `under(self_pid())`, forwards the shutdown and waits
(`examples/graceful_shutdown.rs::drainer_child`). An inline
`GenServerBuilder::run()` (loop as the current actor; ref handed out via a
name or a start callback) would make the primary OTP use case direct. Needed
by urus's endpoint child.
- Supervisor `Live` drop-guard sweep is `request_stop` (kill propagates as
kill); OTP would deliver a trappable `killed`. Chosen for boundedness.
- A root-exit shutdown reaches only actors live *at that instant*; a
non-trapping forest root that spawns before it unwinds leaves that spawn
to itself (Erlang: an unlinked spawn is nobody's child).
## Invariants & gotchas (respect these across all cycles)
- **Shared mutex is non-reentrant.** `Sender::send` can call `unpark` →