summaryrefslogtreecommitdiff
path: root/racer-tracer/src/image_action/wait_for_signal.rs
blob: 54480ac9cae2aa89aec57ef7874d05d4ca470db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::sync::RwLock;

use synchronoise::SignalEvent;

use crate::{config::Config, error::TracerError};

use super::ImageAction;

pub struct WaitForSignal {}

impl ImageAction for WaitForSignal {
    fn action(
        &self,
        _screen_buffer: &RwLock<Vec<u32>>,
        event: &SignalEvent,
        _config: &Config,
    ) -> Result<(), TracerError> {
        if !event.status() {
            println!("Press R to resume.");
            event.wait();
        }
        event.reset();
        Ok(())
    }
}