#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

#597 in Concurrency

Download history 46/week @ 2024-08-26 52/week @ 2024-09-02 35/week @ 2024-09-09 21/week @ 2024-09-16 74/week @ 2024-09-23 17/week @ 2024-09-30 45/week @ 2024-10-07 34/week @ 2024-10-14 33/week @ 2024-10-21 49/week @ 2024-10-28 28/week @ 2024-11-04 18/week @ 2024-11-11 62/week @ 2024-11-18 147/week @ 2024-11-25 111/week @ 2024-12-02 135/week @ 2024-12-09

455 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