pub struct ShutdownSignal {
pub should_shutdown: Arc<AtomicBool>,
pub active_connections: Arc<AtomicUsize>,
pub shutdown_timeout: Duration,
}Expand description
Holds shutdown state and coordination for graceful server termination
Fields§
§should_shutdown: Arc<AtomicBool>Flag indicating if shutdown has been requested
active_connections: Arc<AtomicUsize>Counter tracking active connections
shutdown_timeout: DurationMaximum time to wait for connections to drain during shutdown
Implementations§
Source§impl ShutdownSignal
impl ShutdownSignal
Sourcepub fn new(shutdown_timeout: Duration) -> Self
pub fn new(shutdown_timeout: Duration) -> Self
Creates a new shutdown signal with the specified timeout
Sourcepub fn is_shutdown_requested(&self) -> bool
pub fn is_shutdown_requested(&self) -> bool
Check if shutdown has been requested
Sourcepub fn connection_started(&self)
pub fn connection_started(&self)
Increment the active connection counter
Sourcepub fn connection_finished(&self)
pub fn connection_finished(&self)
Decrement the active connection counter
Sourcepub fn active_connection_count(&self) -> usize
pub fn active_connection_count(&self) -> usize
Get the current number of active connections
Sourcepub fn wait_for_shutdown(&self) -> bool
pub fn wait_for_shutdown(&self) -> bool
Wait for all connections to drain or timeout to expire
Trait Implementations§
Source§impl Clone for ShutdownSignal
impl Clone for ShutdownSignal
Source§fn clone(&self) -> ShutdownSignal
fn clone(&self) -> ShutdownSignal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShutdownSignal
impl Debug for ShutdownSignal
Auto Trait Implementations§
impl Freeze for ShutdownSignal
impl RefUnwindSafe for ShutdownSignal
impl Send for ShutdownSignal
impl Sync for ShutdownSignal
impl Unpin for ShutdownSignal
impl UnsafeUnpin for ShutdownSignal
impl UnwindSafe for ShutdownSignal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more