diff --git a/crates/bevy_tasks/src/task.rs b/crates/bevy_tasks/src/task.rs index b4f6b1eae717d..360909c2e9671 100644 --- a/crates/bevy_tasks/src/task.rs +++ b/crates/bevy_tasks/src/task.rs @@ -41,6 +41,15 @@ impl Task { pub async fn cancel(self) -> Option { self.0.cancel().await } + + /// Returns `true` if the current task is finished. + /// + /// + /// Unlike poll, it doesn't resolve the final value, it just checks if the task has finished. + /// Note that in a multithreaded environment, this task can be finished immediately after calling this function. + pub fn is_finished(&self) -> bool { + self.0.is_finished() + } } impl Future for Task {