zeet

Crates.iozeet
lib.rszeet
version0.1.0
sourcesrc
created_at2024-12-03 05:48:50.449777
updated_at2024-12-03 05:48:50.449777
descriptionWork-stealing thread pool built on crossbeam
homepage
repositoryhttps://github.com/bells307/zeet
max_upload_size
id1469686
size12,717
(bells307)

documentation

README

zeet

Work-stealing thread pool built on crossbeam.

Example

use zeet::WorkStealThreadPool;
use std::sync::mpsc;

fn main() {
    let thread_count = num_cpus::get();

    let tp = WorkStealThreadPool::builder()
        .max_threads(thread_count.try_into().unwrap())
        .build();

    let (tx, rx) = mpsc::channel();

    for _ in 0..thread_count {
        let tx = tx.clone();
        tp.spawn(move || {
            tx.send(1).unwrap();
        });
    }

    assert_eq!(rx.iter().take(thread_count).sum::<usize>(), thread_count);

    tp.join().unwrap();
}
Commit count: 3

cargo fmt