Files
solana/rayon-threadlimit/src/lib.rs
sakridge 7079559c2d Fix windows build by removing sys-info (#8860)
Doesn't build for windows.
2020-03-16 12:53:13 -07:00

15 lines
360 B
Rust

#[macro_use]
extern crate lazy_static;
//TODO remove this hack when rayon fixes itself
lazy_static! {
// reduce the number of threads each pool is allowed to half the cpu core count, to avoid rayon
// hogging cpu
static ref MAX_RAYON_THREADS: usize = num_cpus::get() as usize / 2;
}
pub fn get_thread_count() -> usize {
*MAX_RAYON_THREADS
}