kvarn::shutdown

Struct Manager

source
pub struct Manager { /* private fields */ }
Expand description

Shutdown manager. Contains a counter of connections and a shutdown flag to determine when to initiate a shutdown.

This will wait for all current connections to close, but immediately closes listeners.

Waiting on shutdown is handled using [tokio::sync::watch].

Implementations§

source§

impl Manager

source

pub unsafe fn new(_capacity: usize) -> Self

Creates a new shutdown manager with the capacity of the list of wakers set to _capacity.

§Safety

_capacity >= number of add_listener calls

source

pub fn get_initate_shutdown_watcher(&self) -> WatchReceiver<()>

Available on crate feature graceful-shutdown only.

Gets a watcher for when the shutdown is initiated