Crate

Documentation

A simple job runner library which gives each job a dedicated thread and allows for configurable delays between each invocation of the job's logic.

Example

A program using the JobRunner utility is expected to have this basic outline:

```rust use jobrunner::{Job, JobRunner, fixeddelay};

fn main() { // At program startup, create the JobRunner and register your tasks. let mut jobrunner = JobRunner::new(); jobrunner.start(Job::new( "cooljob", fixeddelay(std::time::Duration::fromsecs(5)), mycool_job));

// Do other things in your program...

// Then, when shutting down your program, signal all the job threads
// to stop running.
job_runner.stop_all();

// Maybe signal other parts of your program to gracefully shut down too...

// Finally (and optionally) wait for the job threads to actually exit.
job_runner.join_all();

}

fn mycooljob() { // Do cool things.. } ```