Clear input thread channel on restore()

The channel may contain Kill commands that will cause the new thread to
exit immediately.
memfd
Manos Pitsidianakis 2020-02-27 16:40:03 +02:00
parent 65666e6695
commit 7807f565ec
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ struct InputHandler {
impl InputHandler {
fn restore(&self, tx: Sender<ThreadEvent>) {
/* Clear channel without blocking. switch_to_main_screen() issues a kill when
* returning from a fork and there's no input thread, so the newly created thread will
* receive it and die. */
let _ = self.rx.try_iter().count();
let rx = self.rx.clone();
thread::Builder::new()
.name("input-thread".to_string())