#channel #signal #crossbeam #termination #interruption #generate

interruptor

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro

2 releases

0.1.1 Apr 11, 2022
0.1.0 Nov 3, 2021

#681 in Unix APIs

Apache-2.0

7KB

interruptor

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.

example

use std::time::Duration;

use crossbeam_channel::{select, tick};
use interruptor::interruption_or_termination;

fn main() {
    let tick = tick(Duration::from_secs(1));
    let stop = interruption_or_termination();

    loop {
        select! {
            recv(tick) -> _ => println!("Running!"),
            recv(stop) -> _ => break,
        }
    };
}

see also

Crossbeam

Crossbeam Channel


lib.rs:

Collection of functions generating Unix process signal receivers for use in the crossbeam_channel::select! macro.

Example

let tick = tick(Duration::from_secs(1));
let stop = interruption_or_termination();

loop {
    select! {
        recv(tick) -> _ => println!("Running!"),
        recv(stop) -> _ => break,
    }
}

Dependencies

~400KB