Crates.io | threadfin |
lib.rs | threadfin |
version | 0.1.2 |
source | src |
created_at | 2021-11-03 04:13:37.053614 |
updated_at | 2023-02-06 01:56:30.652116 |
description | A thread pool for running multiple tasks on a configurable group of threads. |
homepage | |
repository | https://github.com/sagebind/threadfin |
max_upload_size | |
id | 475987 |
size | 68,473 |
A thread pool for running multiple tasks on a configurable group of threads.
Extra features:
Threadfin supports asynchronous usage via futures, and allows you to mix and match both synchronous and asynchronous tasks within a single thread pool.
// Create a new pool.
let pool = threadfin::builder().size(8).build();
// Schedule some work.
let compute_task = pool.execute(|| {
// Some expensive computation
2 + 2
});
// Do something in the meantime.
println!("Waiting for result...");
// Wait for the task to complete and get the result.
let sum = compute_task.join();
println!("Sum: 2 + 2 = {}", sum);
Install via Cargo by adding to your Cargo.toml file:
[dependencies]
threadfin = "0.1"
The minimum supported Rust version (or MSRV) for Threadfin is stable Rust 1.46 or greater, meaning we only guarantee that Threadfin will compile if you use a rustc version of at least 1.46. It might compile with older versions but that could change at any time.
This version is explicitly tested in CI and may only be bumped in new minor versions. Any changes to the supported minimum version will be called out in the release notes.
Special thanks to sponsors of my open-source work!
Licensed under the MIT license. See the LICENSE file for details.