Skip to content

Commit

Permalink
Merge pull request #263 from mahkoh/jorth/ae-opt
Browse files Browse the repository at this point in the history
async_engine: slightly optimize dispatch
  • Loading branch information
mahkoh authored Sep 13, 2024
2 parents 297a6e5 + 0ccc1a2 commit 2c0caa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/async_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ impl AsyncEngine {
continue;
}
self.num_queued.fetch_sub(stash.len());
for runnable in stash.drain(..) {
while let Some(runnable) = stash.pop_front() {
runnable.run();
if self.stopped.get() {
return;
}
}
}
self.yields.swap(&mut *yield_stash);
for waker in yield_stash.drain(..) {
while let Some(waker) = yield_stash.pop_front() {
waker.wake();
}
}
Expand Down

0 comments on commit 2c0caa9

Please sign in to comment.