#background-thread #timer #synchronous #scheduling #jobs #simpler #timer-scheduler

synchronous-timer

Simpler synchronous timer/scheduler for Rust applications

1 unstable release

0.1.0 Jun 6, 2022

#14 in #background-thread

Download history 3/week @ 2024-09-02 35/week @ 2024-09-09 54/week @ 2024-09-16 47/week @ 2024-09-23 63/week @ 2024-09-30 27/week @ 2024-10-07 32/week @ 2024-10-14 18/week @ 2024-10-21 38/week @ 2024-10-28 72/week @ 2024-11-04 42/week @ 2024-11-11 4/week @ 2024-11-18 8/week @ 2024-12-02 76/week @ 2024-12-09 22/week @ 2024-12-16

106 downloads per month

ISC license

20KB
435 lines

This is a library, with an API inspired by timer.rs, for scheduling jobs that run synchronously on a background thread.

CI Documentation crates.io

Example:

use std::time::Duration;
use synchronous_timer::Timer;

fn main() {
    let mut timer = Timer::new();
    timer
        .schedule_in(Duration::from_secs(5), || {
            println!("I will run on the background thread in 5 seconds")
        })
        .detach();
    timer.schedule_immediately(|| println!("I will run on the background thread right now"));
    let handle = timer.schedule_in(Duration::from_secs(1), || println!("I will never run"));
    drop(handle);
    std::thread::sleep(Duration::from_secs(6));
}

This work is licensed under the ISC license, a copy of which can be found in LICENSE.txt.

Dependencies

~0.4–4.5MB
~12K SLoC