1 unstable release
0.1.0 | Jan 6, 2024 |
---|
#998 in Concurrency
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();
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!");
});