[−][src]Function vorarbeiter::setup_term_flag
pub fn setup_term_flag() -> Result<Arc<AtomicBool>, Error>
Sets up a termination flag.
A pure convenience function, creates an atomic boolean that is initially false, but will be set
to true
should the process receive a SIGINT
, SIGTERM
or SIGQUIT
. This works around the
issue that receiving any of these signals would by default not result in any Drop
implementations to be called.
Example
let term = vorarbeiter::setup_term_flag().unwrap(); while !term.load(sync::atomic::Ordering::Relaxed) { // Main loop code here. }