add Task::cancelled

This commit is contained in:
HJfod 2024-08-24 11:31:53 +03:00
parent 971e3fb254
commit 1a82d12b7b

View file

@ -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 = "<Cancelled Task>") {
auto task = Task(Handle::create(name));
Task::cancel(task.m_handle);
return task;
}
/**
* Create a new Task that immediately finishes with the given
* value