Skip to content

Commit fdaf5a5

Browse files
committed
refactor(executor): trace polling at task level
1 parent 967aef3 commit fdaf5a5

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/executor/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ pub(crate) fn run() {
100100
// FIXME(mkroening): Not all tasks register wakers and never sleep
101101
for _ in 0..({ core_local::async_tasks().len() }) {
102102
let mut task = { core_local::async_tasks().pop_front().unwrap() };
103-
trace!("Run async task {}", task.id());
104-
105103
if Pin::new(&mut task).poll(&mut cx).is_pending() {
106104
core_local::async_tasks().push_back(task);
107105
}

src/executor/task.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::sync::atomic::{AtomicU32, Ordering};
88
use core::task::{Context, Poll};
99

1010
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
11-
pub(crate) struct AsyncTaskId(u32);
11+
struct AsyncTaskId(u32);
1212

1313
impl fmt::Display for AsyncTaskId {
1414
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -35,16 +35,13 @@ impl AsyncTask {
3535
future: Box::pin(future),
3636
}
3737
}
38-
39-
pub fn id(&self) -> AsyncTaskId {
40-
self.id
41-
}
4238
}
4339

4440
impl Future for AsyncTask {
4541
type Output = ();
4642

4743
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
44+
trace!("Run async task {}", self.id);
4845
self.as_mut().future.as_mut().poll(cx)
4946
}
5047
}

0 commit comments

Comments
 (0)