Crates.io | thread-count |
lib.rs | thread-count |
version | 0.3.1 |
created_at | 2025-06-12 14:43:06.132836+00 |
updated_at | 2025-06-25 16:17:30.955391+00 |
description | Get the amount of threads in the current process |
homepage | |
repository | https://github.com/AhoyISki/thread-count |
max_upload_size | |
id | 1709879 |
size | 34,222 |
This is a fork of thread-amount
, since
that crate is archived and no longer works.
Get the number of threads in the current process
Cargo.toml
[dependencies]
thread-count = "0.1"
The code:
use thread_count::thread_count;
use std::thread;
fn main() {
let count = thread_count();
thread::spawn(move || {
assert_eq!(count.map(NonZeroUsize::get), Some(1))
});
}
num-threads
This crate has windows support and reads the /proc/[PID]/status
file in -unix
systems.
Thanks goes to these wonderful people (emoji key):
Tomio 💻 📖 💡 🚇 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)