rpools
A minimalist rust workerpool implementation that uses channels to synchronize the jobs. It can spawn a fixed number of worker threads, that waits for a job queue.
Install
$ cargo add rpools
Usage
- A simple workerpool
use WorkerPool;
use channel;
use ;
let n_workers = 4;
let n_jobs = 8;
let pool = new;
let = channel;
let atx = new;
for _ in 0..n_jobs
assert_eq!;
- Use sync module to synchronize your pool
let njobs = 20;
let nworkers = 3;
let pool = new;
let atomic = new;
let wg = default;
// send the jobs to the pool
for _ in 0..njobs
// wait for the pool finnishes
wg.wait;
assert_eq!;