Skip to main content

shutdown_requested

Function shutdown_requested 

Source
pub fn shutdown_requested() -> bool
Expand description

Returns true if a shutdown signal has been received since the process started.

The value reflects the state of SHUTDOWN. Without a ctrlc::set_handler call, the initial state is always false.

ยงExamples

use sqlite_graphrag::shutdown_requested;

// Under normal startup conditions the signal has not been received.
assert!(!shutdown_requested());
use std::sync::atomic::Ordering;
use sqlite_graphrag::{SHUTDOWN, shutdown_requested};

// Simulate receiving a signal and verify that the function reflects the state.
SHUTDOWN.store(true, Ordering::SeqCst);
assert!(shutdown_requested());
// Restore to avoid contaminating other tests.
SHUTDOWN.store(false, Ordering::SeqCst);