mirror of https://github.com/lapce/lapce.git
Use recv when receiving messages and stop checking when the channel closes
This commit is contained in:
parent
28d049c975
commit
134267250e
|
@ -248,7 +248,7 @@ fn start_plugin(
|
||||||
let (tx, rx) = mpsc::channel();
|
let (tx, rx) = mpsc::channel();
|
||||||
|
|
||||||
thread::spawn(move || loop {
|
thread::spawn(move || loop {
|
||||||
match rx.try_recv() {
|
match rx.recv() {
|
||||||
Ok(PluginTransmissionMessage::Initialize) => {
|
Ok(PluginTransmissionMessage::Initialize) => {
|
||||||
let initialize = local_plugin
|
let initialize = local_plugin
|
||||||
.instance
|
.instance
|
||||||
|
@ -283,7 +283,9 @@ fn start_plugin(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_ => {}
|
// There was an error when receiving, which means that the other end was closed.
|
||||||
|
// So we simply shutdown this thread by breaking out of the loop
|
||||||
|
Err(_) => break,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tx.send(PluginTransmissionMessage::Initialize)?;
|
tx.send(PluginTransmissionMessage::Initialize)?;
|
||||||
|
|
Loading…
Reference in New Issue