| Crates.io | thread-amount |
| lib.rs | thread-amount |
| version | 0.3.0 |
| created_at | 2022-06-01 01:34:01.046899+00 |
| updated_at | 2025-12-08 14:42:27.713922+00 |
| description | Get the amount of threads in the current process |
| homepage | |
| repository | https://github.com/jzeuzs/thread-amount |
| max_upload_size | |
| id | 597799 |
| size | 47,002 |
Get the amount of threads in the current process
Cargo.toml
[dependencies]
thread-amount = "0.2"
The code:
use thread_amount::thread_amount;
use std::thread;
fn main() {
let amount = thread_amount();
thread::spawn(move || {
assert_eq!(amount.map(NonZeroUsize::get), Some(1))
});
}
num-threadsThis crate has windows support and reads the /proc/[PID]/status file in -unix systems.
Thanks goes to these wonderful people (emoji key):
jez 💻 📖 🤔 🚧 📦 ⚠️ |
||||||
|
|
||||||
This project follows the all-contributors specification. Contributions of any kind welcome!
Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)