Crates.io | async-cpupool |
lib.rs | async-cpupool |
version | 0.3.0 |
source | src |
created_at | 2023-11-26 03:15:09.927249 |
updated_at | 2024-07-09 20:53:18.67983 |
description | A simple async threadpool for CPU-bound tasks |
homepage | |
repository | https://git.asonix.dog/safe-async/async-cpupool |
max_upload_size | |
id | 1048769 |
size | 113,680 |
A simple async threadpool for CPU-bound tasks
Add to your Cargo.toml
$ cargo add async-cpupool
Use in your application
fn complex_computation() {}
fn main() -> Result<(), Box<dyn std::error::Error>> {
smol::block_on(async {
let pool = async_cpupool::CpuPool::new();
pool.spawn(move || {
complex_computation();
}).await?;
pool.close().await;
Ok(())
})
}
Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.
Copyright © 2023 asonix
Async CPUPool is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Async CPUPool is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of Async CPUPool.
You should have received a copy of the GNU General Public License along with Async CPUPool. If not, see http://www.gnu.org/licenses/.