mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
Don't run until all the way until parked when waiting for a model's next event
This commit is contained in:
parent
6397c05835
commit
f9650b3111
1 changed files with 12 additions and 4 deletions
|
@ -354,10 +354,18 @@ impl<T: Send> Model<T> {
|
|||
})
|
||||
});
|
||||
|
||||
cx.executor().run_until_parked();
|
||||
rx.try_next()
|
||||
.expect("no event received")
|
||||
.expect("model was dropped")
|
||||
loop {
|
||||
match rx.try_next() {
|
||||
Ok(Some(event)) => return event,
|
||||
Ok(None) => panic!("model was dropped"),
|
||||
Err(_) => {
|
||||
if !cx.executor().run_step() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
panic!("no event received")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue