#thread-pool #worker-thread #basic

bin+lib std-threadpool

Threadpool implementation

1 unstable release

0.1.0 Jan 6, 2024

#998 in Concurrency

MIT license

4KB
66 lines

Basic thread pool implementation using some code from the rust book.

Basic usage:

//create a new thread pool with the specified number of threads
let workers: ThreadPool = ThreadPool::new(4);

//execute a closure from the thread pool
workers.execute(|| {
    println!("Hello from a worker thread!");
}).unwrap();

Go to https://docs.rs/std-threadpool/


lib.rs:

Basic thread pool implementation using some code from the rust book.

Basic usage:

//create a new thread pool with the specified number of threads
let workers: ThreadPool = ThreadPool::new(4);

//execute a closure from the thread pool
workers.execute(|| {
    println!("Hello from a worker thread!");
});

No runtime deps