From b29fb68e8f5af4c73f6e7754cea3b2a9c7067d56 Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Mon, 29 Jan 2024 23:17:08 +0100 Subject: [PATCH] fix links --- crates/lavina-core/src/terminator.rs | 7 ++++++- readme.md | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/lavina-core/src/terminator.rs b/crates/lavina-core/src/terminator.rs index 8abbf58..ea971fd 100644 --- a/crates/lavina-core/src/terminator.rs +++ b/crates/lavina-core/src/terminator.rs @@ -1,10 +1,12 @@ use crate::prelude::*; +/// A handle to a task that can be gracefully terminated. pub struct Terminator { signal: Promise<()>, completion: JoinHandle>, } impl Terminator { + /// Send a signal to the task to terminate and await its completion. pub async fn terminate(self) -> Result<()> { match self.signal.send(()) { Ok(()) => {} @@ -14,7 +16,10 @@ impl Terminator { Ok(()) } - /// Used to spawn managed tasks with support for graceful shutdown + /// Spawn a task with support for graceful shutdown. + /// + /// The launched task must listen for the termination signal and stop gracefully on receiving it. + /// The signal is sent by calling the `terminate` method on the returned `Terminator` instance outside the task. pub fn spawn(launcher: Fun) -> Terminator where Fun: FnOnce(Deferred<()>) -> Fut, diff --git a/readme.md b/readme.md index a10c043..803b23a 100644 --- a/readme.md +++ b/readme.md @@ -2,9 +2,9 @@ Multiprotocol chat server based on open protocols. -- [How to run Lavina locally](docs/running.md) -- [Architectural diagrams](docs/flow.md) -- [Project structure](crates/readme.md) +- [How to run Lavina locally](./docs/running.md) +- [Architectural diagrams](./docs/flow.md) +- [Project structure](./crates/readme.md) ## Goals