Merge branch 'main' into polish-project-diagnostics
Also fix false failure in ModelHandle::condition when parking is not forbidden.
This commit is contained in:
commit
8728d3292d
16 changed files with 676 additions and 202 deletions
|
@ -2660,6 +2660,8 @@ impl<T: Entity> ModelHandle<T> {
|
|||
loop {
|
||||
{
|
||||
let cx = cx.borrow();
|
||||
let executor = cx.foreground();
|
||||
|
||||
let cx = cx.as_ref();
|
||||
if predicate(
|
||||
handle
|
||||
|
@ -2670,10 +2672,10 @@ impl<T: Entity> ModelHandle<T> {
|
|||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if cx.borrow_mut().foreground().would_park() {
|
||||
panic!("parked while waiting on condition");
|
||||
if executor.parking_forbidden() && executor.would_park() {
|
||||
panic!("parked while waiting on condition");
|
||||
}
|
||||
}
|
||||
|
||||
rx.recv()
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue