use std::str::FromStr;
thread_local! {
pub static KEEP_TMP: bool = {
match std::env::var("UG_KEEP_TMP") {
Ok(s) => {
!s.is_empty() && s != "0"
},
Err(_) => false,
}
}
}
pub fn get_num_threads() -> usize {
// Respond to the same environment variable as rayon.
match std::env::var("RAYON_NUM_THREADS").ok().and_then(|s| usize::from_str(&s).ok()) {
Some(x) if x > 0 => x,
Some(_) | None => num_cpus::get(),
}
}