LAAAAAIIIIIIIIN

This commit is contained in:
Reece Wilson 2022-07-21 23:23:16 +01:00
parent 1f2599f66b
commit 2470cbc12a
3 changed files with 24 additions and 8 deletions

View File

@ -214,6 +214,8 @@ namespace Aurora::Async
void DoSuccessBlocking();
void DoEndBlocking();
void DispatchNotifier();
WorkerPId_t currentThread_;
SuccessValue_t success;
@ -396,11 +398,7 @@ namespace Aurora::Async
}
else
{
if (!this->notifier_)
{
this->notifier_ = this->currentThread_.pool->NewWorkItem(this->currentThread_, AuSPtr<IWorkItemHandler>(AuSharedFromThis(), &this->tickAdapter));
}
this->notifier_->Dispatch();
DispatchNotifier();
}
}
@ -417,10 +415,22 @@ namespace Aurora::Async
}
else
{
this->notifier_->Dispatch();
DispatchNotifier();
}
}
template<class SuccessValue_t, class ErrorValue_t>
inline void Promise<SuccessValue_t, ErrorValue_t>::DispatchNotifier()
{
if (!this->notifier_)
{
this->notifier_ = this->currentThread_.pool->NewWorkItem(this->currentThread_, AuSPtr<IWorkItemHandler>(AuSharedFromThis(), &this->tickAdapter));
}
SysAssert(this->notifier_);
this->notifier_->Dispatch();
}
template<class SuccessValue_t, class ErrorValue_t>
inline bool Promise<SuccessValue_t, ErrorValue_t>::WaitBeforeWork(const AuSPtr<IWorkItem> &startingBarrier)
{
@ -549,7 +559,7 @@ namespace Aurora::Async
if (failFast)
{
in->OnFailure(this->bHasError_ ? &this->success : nullptr);
in->OnFailure(this->bHasError_ ? &this->error : nullptr);
}
return AuSPtr<Promise>(AuSharedFromThis());

View File

@ -202,6 +202,12 @@ namespace Aurora::Async
void TerminateSceduledTasks(IThreadPoolInternal *pool, WorkerId_t target)
{
if (!gSchedLock)
{
SysAssert(gEntries.empty());
return;
}
AU_LOCK_GUARD(gSchedLock);
for (auto itr = gEntries.begin(); itr != gEntries.end(); )

View File

@ -16,7 +16,7 @@ namespace Aurora::Memory
{
AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment) override
{
return AllocateDivisionGlobal(heap, alignment);
return AllocateDivisionGlobal(this, heap, alignment);
}
void *_ZAlloc(Types::size_t length) override