Created
April 4, 2018 18:21
-
-
Save tobz/dcf3f30ee3d36037b1686059f9faf3dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0382]: use of moved value: `tx` | |
--> src/main.rs:77:21 | |
| | |
77 | tx.send(()).unwrap(); | |
| ^^ value moved here in previous iteration of loop | |
| | |
= note: move occurs because `tx` has type `futures::Sender<()>`, which does not implement the `Copy` trait |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let signals = chan_signal::notify(&[Signal::USR1, Signal::USR2]); | |
let (signal_tx, signal_rx) = oneshot::channel::<()>(); | |
thread::spawn(move || { | |
let tx = signal_tx; | |
loop { | |
let signal = signals.recv().unwrap(); | |
debug!("[core] signal received: {:?}", signal); | |
match signal { | |
Signal::USR1 => { | |
// signal to spawn new process | |
}, | |
Signal::USR2 => { | |
// signal to close this process | |
tx.send(()).unwrap(); | |
}, | |
_ => { | |
// we don't care about the rest | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment