diff --git a/Cargo.toml b/Cargo.toml index e37bb10..2ec7072 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ toml = "0.5.8" simple_logger = "1.11.0" rust-crypto = "^0.2" num_cpus = "1.13.0" -thread-priority = "0.2.1" byteorder = "1.3.2" web-view = { version = "0.7.2", features = [] } tinyfiledialogs = "3.3.10" @@ -38,6 +37,9 @@ derive_more = "0.99.9" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.7", features = ["impl-default", "wincon"]} +[target.'cfg(not(macos))'.dependencies] +thread-priority = "0.2.1" + [build-dependencies] winres = "0.1" diff --git a/src/main.rs b/src/main.rs index b4eae64..5b037be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use std::time::{Duration, Instant}; use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; use rand::RngCore; +#[cfg(not(target_os = "macos"))] use thread_priority::*; use serde::Deserialize; use web_view::*; @@ -421,6 +422,7 @@ fn create_key(context: Arc>) { let mining = mining.clone(); let miners_count = miners_count.clone(); thread::spawn(move || { + #[cfg(not(target_os = "macos"))] let _ = set_current_thread_priority(ThreadPriority::Min); miners_count.fetch_add(1, Ordering::Relaxed); match generate_key(KEYSTORE_DIFFICULTY, mining.clone()) { diff --git a/src/miner.rs b/src/miner.rs index 050c802..dec2cd7 100644 --- a/src/miner.rs +++ b/src/miner.rs @@ -9,6 +9,7 @@ use crypto::sha2::Sha256; #[allow(unused_imports)] use log::{debug, error, info, trace, warn}; use num_cpus; +#[cfg(not(target_os = "macos"))] use thread_priority::*; use crate::{Block, Bytes, Context, hash_is_good}; @@ -143,6 +144,7 @@ impl Miner { let mining = mining.clone(); let live_threads = live_threads.clone(); thread::spawn(move || { + #[cfg(not(target_os = "macos"))] let _ = set_current_thread_priority(ThreadPriority::Min); live_threads.fetch_add(1, Ordering::SeqCst); match find_hash(&mut Sha256::new(), block, mining.clone()) {