[*] bug fixes

This commit is contained in:
Reece Wilson 2024-02-28 14:47:00 +00:00
parent be9f47c4bb
commit 957338d0e3
2 changed files with 10 additions and 5 deletions

View File

@ -21,7 +21,7 @@
namespace Aurora::Async
{
WorkItem::WorkItem(IThreadPoolInternal *owner,
const WorkerPId_t &worker,
AuOptional<WorkerPId_t> worker,
const AuSPtr<IWorkItemHandler> &task) :
worker_(worker), task_(task), owner_(owner),
finishedEvent_(false, true, true)
@ -686,6 +686,8 @@ namespace Aurora::Async
{
if (auto pLoopSource = this->pIOWatchLS)
{
AuSPtr<AuIO::IIOProcessor> pIOProcessor;
if (this->pIOWatch)
{
return true;
@ -694,10 +696,13 @@ namespace Aurora::Async
auto pState = this->GetState();
if (!pState)
{
return false;
pIOProcessor = this->owner_->ToThreadPool()->GetIOProcessor(AuAsync::GetCurrentWorkerPId());
}
else
{
pIOProcessor = pState->singletons.GetIOProcessor(this->worker_.value());
}
auto pIOProcessor = pState->singletons.GetIOProcessor(this->worker_.value());
if (!pIOProcessor)
{
return false;
@ -817,6 +822,6 @@ namespace Aurora::Async
{
pWorker = AuUnsafeRaiiToShared(static_cast<IAsyncApp *>(gAsyncApp));
}
return AuMakeShared<WorkItem>((IThreadPoolInternal *)ToInternal(pWorker).get(), WorkerPId_t {}, AuSPtr<IWorkItemHandler>{});
return AuMakeShared<WorkItem>((IThreadPoolInternal *)ToInternal(pWorker).get(), AuOptional<WorkerPId_t> {}, AuSPtr<IWorkItemHandler>{});
}
}

View File

@ -20,7 +20,7 @@ namespace Aurora::Async
AuEnableSharedFromThis<WorkItem>
{
WorkItem(IThreadPoolInternal *owner,
const WorkerPId_t &worker,
AuOptional<WorkerPId_t> worker,
const AuSPtr<IWorkItemHandler> &task);
~WorkItem();