Run returns a bool
diff --git a/src/raw.rs b/src/raw.rs
index ed3ee97..89d7878 100644
--- a/src/raw.rs
+++ b/src/raw.rs
@@ -31,7 +31,7 @@
pub(crate) destroy: unsafe fn(*const ()),
/// Runs the task.
- pub(crate) run: unsafe fn(*const ()),
+ pub(crate) run: unsafe fn(*const ()) -> bool,
/// Creates a new waker associated with the task.
pub(crate) clone_waker: unsafe fn(ptr: *const ()) -> RawWaker,
@@ -457,7 +457,7 @@
///
/// If polling its future panics, the task will be closed and the panic will be propagated into
/// the caller.
- unsafe fn run(ptr: *const ()) {
+ unsafe fn run(ptr: *const ()) -> bool {
let raw = Self::from_ptr(ptr);
// Create a context from the raw task pointer and the vtable inside the its header.
@@ -480,7 +480,7 @@
// Drop the task reference.
Self::drop_task(ptr);
- return;
+ return false;
}
// Mark the task as unscheduled and running.
@@ -587,6 +587,7 @@
// The thread that woke the task up didn't reschedule it because
// it was running so now it's our responsibility to do so.
Self::schedule(ptr);
+ return true;
} else {
// Drop the task reference.
Self::drop_task(ptr);
@@ -599,6 +600,8 @@
}
}
+ return false;
+
/// A guard that closes the task if polling its future panics.
struct Guard<F, R, S, T>(RawTask<F, R, S, T>)
where