thread-amount

Crates.iothread-amount
lib.rsthread-amount
version0.3.0
created_at2022-06-01 01:34:01.046899+00
updated_at2025-12-08 14:42:27.713922+00
descriptionGet the amount of threads in the current process
homepage
repositoryhttps://github.com/jzeuzs/thread-amount
max_upload_size
id597799
size47,002
jez (jzeuzs)

documentation

https://docs.rs/thread-amount

README

thread-amount

Crate Version Documentation License Continuous Delivery Continuous Integration

Get the amount of threads in the current process

Example Usage

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))
    });
}

Difference between num-threads

This crate has windows support and reads the /proc/[PID]/status file in -unix systems.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

jez
jez

💻 📖 🤔 🚧 📦 ⚠️
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)

Commit count: 0

cargo fmt