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

@ -22,6 +22,7 @@ log = "0.4.8"
memmap = "0.7.0"
num-derive = { version = "0.3" }
num-traits = { version = "0.2" }
num_cpus = "1.0.0"
rand = "0.6.5"
rayon = "1.3.0"
serde = { version = "1.0.105", features = ["rc"] }
@ -37,7 +38,6 @@ solana-storage-program = { path = "../programs/storage", version = "1.1.0" }
solana-vote-program = { path = "../programs/vote", version = "1.1.0" }
tempfile = "3.1.0"
thiserror = "1.0"
thread-priority = "0.1.1"
[lib]

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()