1fad3a1d3Sopenharmony_ci#![allow(dead_code)] 2fad3a1d3Sopenharmony_ci#![allow(clippy::module_name_repetitions, clippy::shadow_unrelated)] 3fad3a1d3Sopenharmony_ci 4fad3a1d3Sopenharmony_ciuse rayon::ThreadPoolBuilder; 5fad3a1d3Sopenharmony_ciuse std::env; 6fad3a1d3Sopenharmony_ci 7fad3a1d3Sopenharmony_cipub mod eq; 8fad3a1d3Sopenharmony_cipub mod parse; 9fad3a1d3Sopenharmony_ci 10fad3a1d3Sopenharmony_ci/// Read the `ABORT_AFTER_FAILURE` environment variable, and parse it. 11fad3a1d3Sopenharmony_cipub fn abort_after() -> usize { 12fad3a1d3Sopenharmony_ci match env::var("ABORT_AFTER_FAILURE") { 13fad3a1d3Sopenharmony_ci Ok(s) => s.parse().expect("failed to parse ABORT_AFTER_FAILURE"), 14fad3a1d3Sopenharmony_ci Err(_) => usize::max_value(), 15fad3a1d3Sopenharmony_ci } 16fad3a1d3Sopenharmony_ci} 17fad3a1d3Sopenharmony_ci 18fad3a1d3Sopenharmony_ci/// Configure Rayon threadpool. 19fad3a1d3Sopenharmony_cipub fn rayon_init() { 20fad3a1d3Sopenharmony_ci let stack_size = match env::var("RUST_MIN_STACK") { 21fad3a1d3Sopenharmony_ci Ok(s) => s.parse().expect("failed to parse RUST_MIN_STACK"), 22fad3a1d3Sopenharmony_ci Err(_) => 20 * 1024 * 1024, 23fad3a1d3Sopenharmony_ci }; 24fad3a1d3Sopenharmony_ci ThreadPoolBuilder::new() 25fad3a1d3Sopenharmony_ci .stack_size(stack_size) 26fad3a1d3Sopenharmony_ci .build_global() 27fad3a1d3Sopenharmony_ci .unwrap(); 28fad3a1d3Sopenharmony_ci} 29