nio-threadpool 0.1.0

general purpose threadpool implementation
Documentation
  • Coverage
  • 0%
    0 out of 19 items documented0 out of 18 items with examples
  • Size
  • Source code size: 7.14 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.47 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • nurmohammed840/nio
    378 12 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nurmohammed840

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 {});
}