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