[+] Added IWorkItem::Cancel
This commit is contained in:
parent
60d2c59d6e
commit
8a6abcfdb7
@ -271,6 +271,12 @@ namespace Aurora::Async
|
||||
return finished;
|
||||
}
|
||||
|
||||
void WorkItem::Cancel()
|
||||
{
|
||||
AU_LOCK_GUARD(lock);
|
||||
Fail();
|
||||
}
|
||||
|
||||
bool WorkItem::HasFailed()
|
||||
{
|
||||
return failed;
|
||||
@ -288,6 +294,11 @@ namespace Aurora::Async
|
||||
|
||||
AUKN_SYM AuSPtr<IWorkItem> NewWorkItem(const DispatchTarget_t &worker, const AuSPtr<IWorkItemHandler> &task, bool supportsBlocking)
|
||||
{
|
||||
if (!task)
|
||||
{
|
||||
SysPushErrorNested("Constructed workitem with a null task. running on stack and reserve heaps alone?");
|
||||
return {};
|
||||
}
|
||||
return AuMakeShared<WorkItem>(worker, task, supportsBlocking);
|
||||
}
|
||||
}
|
@ -29,6 +29,8 @@ namespace Aurora::Async
|
||||
bool HasFinished() override;
|
||||
bool HasFailed() override;
|
||||
|
||||
void Cancel() override;
|
||||
|
||||
void RunAsync() override;
|
||||
void CancelAsync() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user