Merge branch 'main' into polish-project-diagnostics

Also fix false failure in ModelHandle::condition when parking is not forbidden.
This commit is contained in:
Max Brunsfeld 2022-01-05 10:53:18 -08:00
commit 8728d3292d
16 changed files with 676 additions and 202 deletions

View file

@ -260,7 +260,8 @@ impl Deterministic {
impl DeterministicState {
fn would_park(&self) -> bool {
self.scheduled_from_foreground.is_empty()
self.forbid_parking
&& self.scheduled_from_foreground.is_empty()
&& self.scheduled_from_background.is_empty()
&& self.spawned_from_foreground.is_empty()
}
@ -438,6 +439,13 @@ impl Foreground {
*any_value.downcast().unwrap()
}
pub fn parking_forbidden(&self) -> bool {
match self {
Self::Deterministic(executor) => executor.state.lock().forbid_parking,
_ => panic!("this method can only be called on a deterministic executor"),
}
}
pub fn would_park(&self) -> bool {
match self {
Self::Deterministic(executor) => executor.state.lock().would_park(),