Remove thread-priority crate which is not cross-platform (#9023)

This commit is contained in:
sakridge
2020-03-23 12:18:52 -07:00
committed by GitHub
parent 1b8f9e75dd
commit c530fbd22b
3 changed files with 4 additions and 25 deletions

View File

@@ -479,21 +479,9 @@ pub struct AccountsDB {
}
fn make_min_priority_thread_pool() -> ThreadPool {
use thread_priority::{
set_thread_priority, thread_native_id, NormalThreadSchedulePolicy, ThreadPriority,
ThreadSchedulePolicy,
};
let num_threads = get_thread_count();
// Use lower thread count to reduce priority.
let num_threads = std::cmp::max(2, num_cpus::get() / 4);
rayon::ThreadPoolBuilder::new()
.start_handler(|_id| {
let thread_id = thread_native_id();
set_thread_priority(
thread_id,
ThreadPriority::Min,
ThreadSchedulePolicy::Normal(NormalThreadSchedulePolicy::Normal),
)
.unwrap();
})
.thread_name(|i| format!("solana-accounts-cleanup-{}", i))
.num_threads(num_threads)
.build()