diff --git a/loader/include/Geode/utils/Task.hpp b/loader/include/Geode/utils/Task.hpp index 38868bf1..d6691257 100644 --- a/loader/include/Geode/utils/Task.hpp +++ b/loader/include/Geode/utils/Task.hpp @@ -390,6 +390,15 @@ namespace geode { return m_handle == nullptr; } + /** + * Create a new Task that is immediately cancelled + * @param name The name of the Task; used for debugging + */ + static Task cancelled(std::string_view const name = "") { + auto task = Task(Handle::create(name)); + Task::cancel(task.m_handle); + return task; + } /** * Create a new Task that immediately finishes with the given * value