minion
This crate provides a wrapper type for making long-running service loops cancellable.
Let's dive right in with an example. For further details see
Cancellable
.
// impl Cancellable for Service { .. }
let s = new;
// start the service loop on a new thread
let h = s.spawn;
// get a handle that allows cancelling the service loop
let exit = h.canceller;
// spin up a new thread that will handle exit signals
spawn;
// block until the service loop exits or errors.
h.wait.unwrap;