Skip to content

Commit 613b82a

Browse files
committed
Fix a possible deadlock
1 parent 3482b36 commit 613b82a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/src/context/async/future.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ where
112112

113113
let spawner = unsafe { lock.runtime.get_opaque_mut() }.spawner();
114114
match spawner.poll(cx) {
115-
SchedularPoll::Empty | SchedularPoll::ShouldYield => {
116-
// if the schedular is empty that means the future is waiting on an external
117-
// future so we should return the schedular.
115+
SchedularPoll::Empty => {
116+
// if the schedular is empty that means the future is waiting on an external or
117+
// on a promise.
118+
}
119+
SchedularPoll::ShouldYield => {
118120
this.state = WithFutureState::FutureCreated { future };
119121
return Poll::Pending;
120122
}

core/src/runtime/schedular.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use queue::Queue;
2121

2222
use self::task::ErasedTaskPtr;
2323

24+
#[derive(Debug)]
2425
pub enum SchedularPoll {
2526
/// Returns that the schedular should yield back to the root schedular.
2627
ShouldYield,

0 commit comments

Comments
 (0)