1
0
Fork 0
forked from wry/wry

Merge pull request #263 from mahkoh/jorth/ae-opt

async_engine: slightly optimize dispatch
This commit is contained in:
mahkoh 2024-09-13 12:32:39 +02:00 committed by GitHub
commit 2c0caa9725
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,7 +97,7 @@ 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;
@ -105,7 +105,7 @@ impl AsyncEngine {
}
}
self.yields.swap(&mut *yield_stash);
for waker in yield_stash.drain(..) {
while let Some(waker) = yield_stash.pop_front() {
waker.wake();
}
}