Skip to content

Commit f188005

Browse files
committed
fix loom?
1 parent eaf4e7c commit f188005

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tokio/src/runtime/task/harness.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use crate::future::Future;
2+
#[cfg(tokio_unstable)]
3+
use crate::runtime::context::with_task_hooks;
24
use crate::runtime::task::core::{Cell, Core, Header, Trailer};
35
use crate::runtime::task::state::{Snapshot, State};
46
use crate::runtime::task::waker::waker_ref;
@@ -153,16 +155,14 @@ where
153155
let res = self.poll_inner();
154156

155157
#[cfg(tokio_unstable)]
156-
self.trailer().hooks.with_mut(|ptr| unsafe {
157-
ptr.as_mut().and_then(|x| {
158-
x.as_mut().map(|x| {
159-
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
160-
x.after_poll(&mut AfterTaskPollContext {
161-
_phantom: Default::default(),
162-
})
163-
}));
164-
})
165-
});
158+
let _ = with_task_hooks(|t| {
159+
if let Some(hooks) = t {
160+
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
161+
hooks.after_poll(&mut AfterTaskPollContext {
162+
_phantom: Default::default(),
163+
})
164+
}));
165+
}
166166
});
167167

168168
// We pass our ref-count to `poll_inner`.

0 commit comments

Comments
 (0)