[*] Prevent pinning another WorkItems lock within the parent scope of some ::Fail's
This commit is contained in:
parent
6de84b474e
commit
e30be64c44
@ -28,32 +28,55 @@ namespace Aurora::Async
|
||||
|
||||
void WorkItem::WaitFor(const AuSPtr<IWorkItem> &workItem)
|
||||
{
|
||||
auto dependency = std::reinterpret_pointer_cast<WorkItem>(workItem);
|
||||
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l(lock);
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l2(dependency->lock);
|
||||
|
||||
dependency->waiters_.push_back(shared_from_this());
|
||||
waitOn_.push_back(workItem);
|
||||
}
|
||||
|
||||
void WorkItem::WaitFor(const AuList<AuSPtr<IWorkItem>> &workItems)
|
||||
{
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l(lock);
|
||||
bool status {};
|
||||
|
||||
for (auto &workItem : workItems)
|
||||
{
|
||||
auto dependency = std::reinterpret_pointer_cast<WorkItem>(workItem);
|
||||
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l(lock);
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l2(dependency->lock);
|
||||
|
||||
if (dependency->HasFailed())
|
||||
{
|
||||
Fail();
|
||||
status = true;
|
||||
}
|
||||
|
||||
dependency->waiters_.push_back(shared_from_this());
|
||||
waitOn_.push_back(workItem);
|
||||
}
|
||||
|
||||
if (status)
|
||||
{
|
||||
Fail();
|
||||
}
|
||||
}
|
||||
|
||||
void WorkItem::WaitFor(const AuList<AuSPtr<IWorkItem>> &workItems)
|
||||
{
|
||||
bool status {};
|
||||
|
||||
{
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l(lock);
|
||||
|
||||
for (auto &workItem : workItems)
|
||||
{
|
||||
auto dependency = std::reinterpret_pointer_cast<WorkItem>(workItem);
|
||||
Threading::LockGuard<Threading::Primitives::SpinLock> l2(dependency->lock);
|
||||
|
||||
if (dependency->HasFailed())
|
||||
{
|
||||
status = true;
|
||||
}
|
||||
|
||||
dependency->waiters_.push_back(shared_from_this());
|
||||
waitOn_.push_back(workItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (status)
|
||||
{
|
||||
Fail();
|
||||
}
|
||||
}
|
||||
|
||||
void WorkItem::SetSchedTime(AuUInt32 ms)
|
||||
|
Loading…
Reference in New Issue
Block a user