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
+6
View File
@@ -66,6 +66,12 @@ fn main() {
let svc: Option<GenServerRef<Counter>> = whereis_server(COUNTER);
if let Some(svc) = svc {
let _ = svc.call(Query::Get);
// A named server is pinned alive by the registry, so dropping refs
// does not end it. Stop it explicitly: `shutdown()` asks politely
// (a trapping server drains first; this one is stopped outright)
// and waits until it is gone. Left running, the root's return
// would shut it down the same way — see examples/graceful_shutdown.rs.
svc.shutdown();
}
});
}