tcplane/utils/thread/fn.rs
1/// Gets the number of available threads for parallel processing.
2///
3/// This function returns the number of threads that the system can execute simultaneously,
4/// which is useful for determining optimal parallelism levels.
5///
6/// # Returns
7///
8/// - `usize` - The number of available threads, or 1 if the value cannot be determined.
9pub fn get_thread_count() -> usize {
10 match std::thread::available_parallelism() {
11 Ok(count) => count.get(),
12 Err(_) => 1,
13 }
14}