Struct shellflip::shutdown::ShutdownCoordinator
source · pub struct ShutdownCoordinator { /* private fields */ }Expand description
Coordinates the shutdown process for a group of tasks. This allows the tasks to get notified when a shutdown is requested, and allows the main thread to defer termination until all of the tasks have successfully completed.
Implementations§
source§impl ShutdownCoordinator
impl ShutdownCoordinator
sourcepub fn new() -> Self
pub fn new() -> Self
Get a cancellation channel that, when dropped, can be used to close all proxy endpoints created from this object.
sourcepub fn handle(&self) -> Arc<ShutdownHandle>
pub fn handle(&self) -> Arc<ShutdownHandle>
Get a ShutdownHandle to be held by a task that needs to be waited on during shutdown.
sourcepub fn handle_weak(&self) -> Weak<ShutdownHandle>
pub fn handle_weak(&self) -> Weak<ShutdownHandle>
Get a ShutdownHandle that can be held by a task that does not need to be waited on, but may spawn tasks that should be waited on. If the task can upgrade the handle with Arc::upgrade, then shutdown has not yet started.
sourcepub async fn shutdown(self)
pub async fn shutdown(self)
Initiate shutdown and wait for its successful completion. To prevent new connections from being accepted, drop any listening tasks first.
sourcepub async fn shutdown_with_timeout(self, timeout: u64)
pub async fn shutdown_with_timeout(self, timeout: u64)
Shutdown, waiting a maximum amount of time before returning.