Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon1777 committed Aug 24, 2024
1 parent b583f18 commit 6381155
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ use karlsen_miner::{PluginManager, WorkerSpec};

type MinerHandler = std::thread::JoinHandle<Result<(), Error>>;

#[cfg(any(target_os = "linux", target_os = "mac_os"))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
extern "C" fn signal_panic(_signal: nix::libc::c_int) {
panic!("Forced shutdown");
}

#[cfg(any(target_os = "linux", target_os = "mac_os"))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn register_freeze_handler() {
let handler = nix::sys::signal::SigHandler::Handler(signal_panic);
unsafe {
nix::sys::signal::signal(nix::sys::signal::Signal::SIGUSR1, handler).unwrap();
}
}

#[cfg(any(target_os = "linux", target_os = "mac_os"))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn trigger_freeze_handler(kill_switch: Arc<AtomicBool>, handle: &MinerHandler) -> std::thread::JoinHandle<()> {
use std::os::unix::thread::JoinHandleExt;
let pthread_handle = handle.as_pthread_t();
Expand Down Expand Up @@ -72,12 +72,12 @@ fn trigger_freeze_handler(kill_switch: Arc<AtomicBool>, handle: &MinerHandler) -
})
}

#[cfg(not(any(target_os = "linux", target_os = "mac_os", target_os = "windows")))]
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
fn trigger_freeze_handler(kill_switch: Arc<AtomicBool>, handle: &MinerHandler) {
warn!("Freeze handler is not implemented. Frozen threads are ignored");
}

#[cfg(not(any(target_os = "linux", target_os = "mac_os", target_os = "windows")))]
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
fn register_freeze_handler() {
warn!("Freeze handler is not implemented. Frozen threads are ignored");
}
Expand Down

0 comments on commit 6381155

Please sign in to comment.