Skip to content

Commit

Permalink
rollback do tp to mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Beng committed Nov 24, 2023
1 parent 016d4cf commit 37ce864
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn main() {
let f_inter_signal = Arc::new(RwLock::new(50 as u32));
let f_gap_signal = Arc::new(RwLock::new(85 as u32));
let scroll_gap_signal = Arc::new(RwLock::new(70 as u32));
let click_tp_signal = Arc::new(RwLock::new(click_tp));
let click_tp_signal = Arc::new(Mutex::new(click_tp));

let mut is_cloud = false;
let hwnd = match capture::find_window_local() {
Expand Down Expand Up @@ -546,7 +546,7 @@ fn main() {
hotkey::modifiers::ALT,
'9' as u32,
move || {
let mut signal = click_tp_signal_clone.write().unwrap();
let mut signal = click_tp_signal_clone.lock().unwrap();
*signal = !*signal;
warn!("ALT + 9 切换 click tp 模式为 {}", *signal);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pickupper/pickupper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct PickupCofig {
pub f_inter: Arc<RwLock<u32>>,
pub f_gap: Arc<RwLock<u32>>,
pub scroll_gap: Arc<RwLock<u32>>,
pub click_tp: Arc<RwLock<bool>>,
pub click_tp: Arc<Mutex<bool>>,
}

pub struct Pickupper {
Expand Down Expand Up @@ -304,7 +304,7 @@ impl Pickupper {
thread::spawn(move || {

loop {
let do_click = click_lock.read().unwrap();
let do_click = click_lock.lock().unwrap();

let img = rx_tp.recv().unwrap();
let img_gray = grayscale(&img);
Expand Down

0 comments on commit 37ce864

Please sign in to comment.