Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
fix: sleep in async executor loops
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin-Niederman committed Jan 4, 2024
1 parent 6a76344 commit 8659f6b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pros/src/async_runtime/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ use core::{
pin::Pin,
sync::atomic::{AtomicBool, Ordering},
task::{Context, Poll},
time::Duration,
};

use alloc::{collections::VecDeque, sync::Arc};
use async_task::{Runnable, Task};
use waker_fn::waker_fn;

use crate::os_task_local;
use crate::{os_task_local, task::delay};

use super::reactor::Reactor;

Expand Down Expand Up @@ -82,6 +83,7 @@ impl Executor {
}

self.tick();
delay(Duration::from_millis(10));
}
}

Expand All @@ -90,6 +92,7 @@ impl Executor {
if !self.tick() {
break;
}
delay(Duration::from_millis(10));
}
}
}

0 comments on commit 8659f6b

Please sign in to comment.