#thread-pool #nio

nio-threadpool

general purpose threadpool implementation

1 unstable release

Uses new Rust 2024

0.1.0 Jan 24, 2026

#9 in #nio

Download history 38/week @ 2026-01-28 24/week @ 2026-02-04 1/week @ 2026-02-11 103/week @ 2026-02-18 3/week @ 2026-02-25 55/week @ 2026-03-11 165/week @ 2026-03-18

225 downloads per month
Used in 3 crates (via nio)

Apache-2.0

12KB
273 lines

Example

use nio_threadpool::{Runnable, ThreadPool};
use std::{thread, time::Duration};

struct Task {}

impl Runnable for Task {
    fn run(self) {
        println!("{:#?}", thread::current());
    }
}

#[test]
fn example() {
    let pool = ThreadPool::new()
        .max_threads_limit(2)
        .timeout(Some(Duration::from_secs(3)))
        .stack_size(512)
        .name(|id| format!("Worker-{id}"));

    pool.execute(Task {});
    pool.execute(Task {});
    pool.execute(Task {});
}

Dependencies