Crates.io | thrdpool |
lib.rs | thrdpool |
version | 0.1.0 |
source | src |
created_at | 2022-10-18 02:13:26.203673 |
updated_at | 2022-10-18 02:13:26.203673 |
description | Creates a threadpool to run multiple jobs in parallel |
homepage | |
repository | https://github.com/matteac/thrdpool |
max_upload_size | |
id | 690566 |
size | 2,686 |
A simple package to run multiple jobs in a threadpool
// you can handle 4 connections !!!!!!
let pool = ThreadPool::new(4);
for stream in listener.incoming() {
let stream = stream.unwrap();
pool.execute(|| {
handle_connection(stream);
println!("Connection handled!");
})
}