Crates.io | scheduling |
lib.rs | scheduling |
version | 0.1.2 |
source | src |
created_at | 2020-06-10 17:09:54.434903 |
updated_at | 2020-06-11 15:10:13.720496 |
description | A simple job scheduler |
homepage | |
repository | |
max_upload_size | |
id | 252436 |
size | 6,973 |
A very simple job scheduler. Runs one job (one-time or recurring) on one spawned thread.
fn main() {
let _once_handle = scheduling::Scheduler::once(|| println!("ONCE")).start();
let recurring_handle = scheduling::Scheduler::delayed_recurring(
std::time::Duration::from_secs(1),
std::time::Duration::from_secs(1),
|| println!("1 SEC ELAPSED"),
)
.start();
std::thread::sleep(std::time::Duration::from_secs(5));
recurring_handle.cancel();
std::thread::sleep(std::time::Duration::from_secs(5));
}
License: MIT