Cleanup join_layout a little bit.

This commit is contained in:
Ms2ger 2015-02-12 22:42:06 +01:00
parent b351b216c6
commit 79914e560f

View file

@ -327,25 +327,23 @@ impl Page {
/// layout task has finished any pending request messages.
fn join_layout(&self) {
let mut layout_join_port = self.layout_join_port.borrow_mut();
if layout_join_port.is_some() {
let join_port = replace(&mut *layout_join_port, None);
match join_port {
Some(ref join_port) => {
match join_port.try_recv() {
Err(Empty) => {
info!("script: waiting on layout");
join_port.recv().unwrap();
}
Ok(_) => {}
Err(Disconnected) => {
panic!("Layout task failed while script was waiting for a result.");
}
let join_port = replace(&mut *layout_join_port, None);
match join_port {
Some(ref join_port) => {
match join_port.try_recv() {
Err(Empty) => {
info!("script: waiting on layout");
join_port.recv().unwrap();
}
Ok(_) => {}
Err(Disconnected) => {
panic!("Layout task failed while script was waiting for a result.");
}
debug!("script: layout joined")
}
None => panic!("reader forked but no join port?"),
debug!("script: layout joined")
}
None => (),
}
}