This is a safe Rust thread pool library.
It is part of safina
, a safe async runtime.
forbid(unsafe_code)
std
https://docs.rs/safina-threadpool
rust
let pool =
safina_threadpool::ThreadPool::new("worker", 2);
let receiver = {
let (sender, receiver) =
std::sync::mpsc::channel();
for data in data_source {
let sender_clone = sender.clone();
pool.schedule(
move || process_data(data, sender_clone));
}
receiver
};
let results: Vec<ProcessResult> =
receiver.iter().collect();
// ...
unsafe
codeunsafe
codeunsafe
unsafe
codeunsafe
codeunsafe
codeunsafe
unsafe
codeunsafe
codeunsafe
codeunsafe
unsafe
schedule
and try_schedule
Cargo.toml
and bump version number../release.sh
License: Apache-2.0