spawn-wait 0.2.2

Spawn and manage a set of processes each associated with a key, and wait on all or part of them simultaneously.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use spawn_wait::SignalHandler;

fn main() {
  let mut sh = SignalHandler::default();
  println!("Try using ctrl+c.");
  loop {
    if sh.termination_pending() {
      println!("Termination signal received.");
      break;
    }
    std::thread::sleep(std::time::Duration::from_millis(100));
  }
}