Returned low thread priorty as it seems after thorough tests that there is an impact afterall. But this functionality is now controlled by option 'mining.lower'.

This commit is contained in:
Revertron
2021-04-10 14:03:52 +02:00
parent a74a0733ac
commit 3900790f03
7 changed files with 46 additions and 8 deletions
+22
View File
@@ -5,6 +5,9 @@ pub mod constants;
pub use constants::*;
use std::net::IpAddr;
#[cfg(not(target_os = "macos"))]
use thread_priority::*;
/// Convert bytes array to HEX format
pub fn to_hex(buf: &[u8]) -> String {
let mut result = String::new();
@@ -91,6 +94,25 @@ pub fn is_yggdrasil(addr: &IpAddr) -> bool {
false
}
#[cfg(target_os = "windows")]
#[allow(unused_variables)]
pub fn setup_miner_thread(cpu: u32) {
let _ = set_current_thread_priority(ThreadPriority::Min);
//let _ = set_current_thread_ideal_processor(IdealProcessor::from(cpu));
}
#[cfg(target_os = "linux")]
#[allow(unused_variables)]
pub fn setup_miner_thread(cpu: u32) {
let _ = set_current_thread_priority(ThreadPriority::Min);
}
#[cfg(target_os = "macos")]
#[allow(unused_variables)]
pub fn setup_miner_thread(cpu: u32) {
// MacOS is not supported by thread_priority crate
}
#[cfg(test)]
mod test {
use crate::{check_domain, is_yggdrasil};