#strategy #agrona #async

idle

Collection of idle strategies to be used by thread(s) when they have no work to perform

2 unstable releases

0.2.0 Apr 6, 2024
0.1.0 Apr 6, 2024

#296 in Concurrency

Download history 201/week @ 2024-04-01 68/week @ 2024-04-08 24/week @ 2024-04-15

293 downloads per month
Used in boomnet

MIT license

5KB

Build Status Crates.io Documentation License: MIT

Collection of idle strategies to be used by thread(s) when they have no work to perform. Inspired by IdleStrategy from Agrona.

use std::time::Duration;
use idle::IdleStrategy;

let idle = IdleStrategy::Sleep(Duration::from_millis(1));
loop {
    // application logic
    idle.idle(0);
}

lib.rs:

Collection of idle strategies to be used by thread(s) when they have no work to perform.

Examples

use std::time::Duration;
use idle::IdleStrategy;

let idle = IdleStrategy::Sleep(Duration::from_millis(1));
loop {
    // application logic
    idle.idle(0);
}

No runtime deps