We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63e0a93 commit 13fbe6fCopy full SHA for 13fbe6f
src/local_executor.rs
@@ -431,13 +431,19 @@ impl State {
431
}
432
433
pub async fn run<T>(&self, future: impl Future<Output = T>) -> T {
434
- let mut ticker = Ticker::new(self);
435
-
436
// A future that runs tasks forever.
437
let run_forever = async {
438
loop {
439
for _ in 0..200 {
440
- ticker.runnable().await.run();
+ // SAFETY: All UnsafeCell accesses to queue are tightly scoped, and because
+ // `LocalExecutor` is !Send, there is no way to have concurrent access to the
+ // values in `State`, including the queue field.
441
+ match unsafe { &mut *self.queue.get() }.pop_back() {
442
+ Some(runnable) => {
443
+ runnable.run();
444
+ }
445
+ None => break,
446
447
448
future::yield_now().await;
449
0 commit comments