aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rtic/src/export/executor.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/rtic/src/export/executor.rs b/rtic/src/export/executor.rs
index bc31bf8..7bc7582 100644
--- a/rtic/src/export/executor.rs
+++ b/rtic/src/export/executor.rs
@@ -192,11 +192,16 @@ impl<F: Future + 'static> AsyncTaskExecutor<F> {
self.set_pending();
}
+ #[inline(always)]
+ pub const fn waker(&self, wake: fn()) -> Waker {
+ unsafe { Waker::from_raw(RawWaker::new(wake as *const (), &WAKER_VTABLE)) }
+ }
+
/// Poll the future in the executor.
#[inline(always)]
pub fn poll(&self, wake: fn()) {
if self.is_running() && self.check_and_clear_pending() {
- let waker = unsafe { Waker::from_raw(RawWaker::new(wake as *const (), &WAKER_VTABLE)) };
+ let waker = self.waker(wake);
let mut cx = Context::from_waker(&waker);
let future = unsafe { Pin::new_unchecked(&mut *(self.task.get() as *mut F)) };