[*] Ensure failure on waiters if a task we're waiting on has already failed
This commit is contained in:
parent
452b49b610
commit
23ddb0f2f6
@ -45,6 +45,12 @@ namespace Aurora::Async
|
||||
{
|
||||
auto dependency = std::reinterpret_pointer_cast<WorkItem>(workItem);
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l2(dependency->lock);
|
||||
|
||||
if (dependency->HasFailed())
|
||||
{
|
||||
Fail();
|
||||
}
|
||||
|
||||
dependency->waiters_.push_back(shared_from_this());
|
||||
waitOn_.push_back(workItem);
|
||||
}
|
||||
@ -77,6 +83,11 @@ namespace Aurora::Async
|
||||
dispatchPending_ = true;
|
||||
}
|
||||
|
||||
if (HasFailed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto itr = waitOn_.begin(); itr != waitOn_.end(); )
|
||||
{
|
||||
auto &waitable = *itr;
|
||||
@ -98,9 +109,9 @@ namespace Aurora::Async
|
||||
SendOff();
|
||||
}
|
||||
|
||||
|
||||
void WorkItem::CancelAsync()
|
||||
{
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l(lock);
|
||||
Fail();
|
||||
}
|
||||
|
||||
@ -130,8 +141,9 @@ namespace Aurora::Async
|
||||
SetSchedTime(info.reschedMs);
|
||||
}
|
||||
WaitFor(info.waitFor);
|
||||
// fall through
|
||||
|
||||
}
|
||||
[[fallthrough]];
|
||||
case IWorkItemHandler::EProcessNext::eRerun:
|
||||
{
|
||||
DispatchEx(false);
|
||||
|
Loading…
Reference in New Issue
Block a user