[*] Global build regressions caused by addd4080

This commit is contained in:
Reece Wilson 2023-09-15 18:08:02 +01:00
parent d49d4ad4fc
commit d0fb19f87e
7 changed files with 31 additions and 32 deletions

View File

@ -36,7 +36,7 @@ namespace Aurora::Async
// old sewage to be cleaned up
static bool gBOriginal;
static AuWorkerPId_t gMainThread;
static AuOptionalEx<AuWorkerPId_t> gMainThread;
void StartSched2();
static void SchedNextTime(AuUInt64 uNSAbs);
@ -171,7 +171,7 @@ namespace Aurora::Async
{
if (!AuExchange(gLockedPump, true))
{
NewWorkItem(gMainThread, AuMakeShared<BasicWorkStdFunc>(PumpSysThread))->Dispatch();
NewWorkItem(gMainThread.value(), AuMakeShared<BasicWorkStdFunc>(PumpSysThread))->Dispatch();
}
SchedNextTime(AuMSToNS<AuUInt64>(gRuntimeConfig.async.dwLegacyMainThreadSystemTickMS) + AuTime::SteadyClockNS());
@ -197,12 +197,11 @@ namespace Aurora::Async
AUKN_SYM void SetMainThreadForSysPumpScheduling(AuWorkerPId_t pid)
{
if (!pid)
if (!pid.pool)
{
gRuntimeConfig.async.bEnableLegacyTicks = gBOriginal;
gMainThread = AuWorkerPId_t(AuAsync::GetSharedAsyncApp(), AuWorkerId_t {0, 0});
AuResetMember(gMainThread);
Console::Commands::UpdateDispatcher(gMainThread);
return;
}

View File

@ -480,7 +480,7 @@ namespace Aurora::Async
auto pWorker = GetCurrentWorkerPId().pool;
if (!pWorker)
{
pWorker = AuUnsafeRaiiToShared(gAsyncApp);
pWorker = AuUnsafeRaiiToShared(static_cast<IAsyncApp *>(gAsyncApp));
}
return AuMakeShared<WorkItem>(ToInternal(pWorker).get(), WorkerPId_t { pWorker , worker }, task);
@ -504,7 +504,7 @@ namespace Aurora::Async
if (!pWorker)
{
pWorker = AuUnsafeRaiiToShared(gAsyncApp);
pWorker = AuUnsafeRaiiToShared(static_cast<IAsyncApp *>(gAsyncApp));
}
return AuMakeSharedThrow<FuncWorker>(ToInternal(pWorker).get(), worker, AuMove(func));
@ -528,7 +528,7 @@ namespace Aurora::Async
if (!pWorker)
{
pWorker = AuUnsafeRaiiToShared(gAsyncApp);
pWorker = AuUnsafeRaiiToShared(static_cast<IAsyncApp *>(gAsyncApp));
}
return AuMakeSharedThrow<WorkItem>(ToInternal(pWorker).get(), worker, task);
@ -539,7 +539,7 @@ namespace Aurora::Async
auto pWorker = GetCurrentWorkerPId().pool;
if (!pWorker)
{
pWorker = AuUnsafeRaiiToShared(gAsyncApp);
pWorker = AuUnsafeRaiiToShared(static_cast<IAsyncApp *>(gAsyncApp));
}
return AuMakeShared<WorkItem>((IThreadPoolInternal *)ToInternal(pWorker).get(), WorkerPId_t {}, AuSPtr<IWorkItemHandler>{});
}

View File

@ -23,9 +23,9 @@ namespace Aurora::Console::Commands
static AuHashMap<AuString, Command> gCommands;
static AuList<Hooks::LineHook_cb> gLineCallbacks;
static AuList<CommandDispatch> gPendingCommands;
static AuThreadPrimitives::Mutex gMutex;
static AuThreadPrimitives::Mutex gPendingCommandsMutex;
static Async::WorkerPId_t gCommandDispatcher;
static AuMutex gMutex;
static AuMutex gPendingCommandsMutex;
static AuOptionalEx<AuWorkerPId_t> gCommandDispatcher;
struct Command
{
@ -44,7 +44,7 @@ namespace Aurora::Console::Commands
eAsync
};
static bool Dispatch(const AuString &string, EDispatchType type, Async::WorkerPId_t workerId)
static bool Dispatch(const AuString &string, EDispatchType type, AuOptionalEx<AuWorkerPId_t> workerId)
{
Parse::ParseResult res;
AuSPtr<ICommandSubscriber> callback;
@ -102,9 +102,9 @@ namespace Aurora::Console::Commands
{
callback->OnCommand(res.result);
}
else
else if (workerId)
{
Async::NewWorkFunction(workerId, [=]() -> void
Async::NewWorkFunction(workerId.value(), [=]() -> void
{
callback->OnCommand(res.result);
});
@ -146,7 +146,7 @@ namespace Aurora::Console::Commands
return Dispatch(string, EDispatchType::eAsync, id);
}
void UpdateDispatcher(AuOptional<Async::WorkerPId_t> target)
void UpdateDispatcher(AuOptionalEx<AuWorkerPId_t> target)
{
AU_LOCK_GUARD(gMutex);
AU_LOCK_GUARD(gPendingCommandsMutex);
@ -161,7 +161,7 @@ namespace Aurora::Console::Commands
}
}
gCommandDispatcher = target.value();
gCommandDispatcher = target;
}
static void DispatchCommandsFromThis(const AuList<CommandDispatch> &commands)
@ -180,7 +180,7 @@ namespace Aurora::Console::Commands
}
else
{
NewWorkItem(gCommandDispatcher, AuMakeShared<Async::BasicWorkStdFunc>(func))->Dispatch()->BlockUntilComplete();
NewWorkItem(gCommandDispatcher.value(), AuMakeShared<Async::BasicWorkStdFunc>(func))->Dispatch()->BlockUntilComplete();
}
}

View File

@ -9,7 +9,7 @@
namespace Aurora::Console::Commands
{
void UpdateDispatcher(AuOptional<Async::WorkerPId_t> target);
void UpdateDispatcher(AuOptionalEx<Async::WorkerPId_t> target);
void PumpCommands();
void RunCommandFunction(const AuFunction<void()> &func);
}

View File

@ -75,7 +75,7 @@ namespace Aurora::IO
if (asyncWorker)
{
AuAtomicAdd(&AuStaticCast<AuAsync::ThreadPool>(asyncWorker.pool)->uAtomicIOProcessors, 1u);
AuAtomicAdd(&AuStaticCast<AuAsync::ThreadPool>(asyncWorker.value().pool)->uAtomicIOProcessors, 1u);
}
return true;
@ -633,9 +633,9 @@ namespace Aurora::IO
void IOProcessor::AddTimerLS()
{
if (asyncWorker)
if (auto optWorker = this->asyncWorker)
{
AuAtomicAdd(&AuStaticCast<AuAsync::ThreadPool>(asyncWorker.pool)->uAtomicIOProcessorsWorthlessSources, 1u);
AuAtomicAdd(&AuStaticCast<AuAsync::ThreadPool>(optWorker.value().pool)->uAtomicIOProcessorsWorthlessSources, 1u);
}
this->ToQueue()->SourceAdd(this->timers.pLsTicker);
@ -647,7 +647,7 @@ namespace Aurora::IO
{
if (!this->pWorkItem)
{
this->pWorkItem = this->asyncWorker.pool->NewWorkItem(this->asyncWorker, AuSharedFromThis());
this->pWorkItem = this->asyncWorker.value().pool->NewWorkItem(this->asyncWorker.value(), AuSharedFromThis());
}
this->pWorkItem->SetSchedTimeNs(this->refreshRateNs);
@ -688,15 +688,15 @@ namespace Aurora::IO
queue->SourceRemove(this->timers.pLsTicker);
if (asyncWorker)
if (auto optWorker = this->asyncWorker)
{
AuAtomicSub(&AuStaticCast<AuAsync::ThreadPool>(asyncWorker.pool)->uAtomicIOProcessorsWorthlessSources, 1u);
AuAtomicSub(&AuStaticCast<AuAsync::ThreadPool>(optWorker.value().pool)->uAtomicIOProcessorsWorthlessSources, 1u);
}
}
bool IOProcessor::IsAsync()
{
return bool(this->asyncWorker.pool);
return bool(this->asyncWorker);
}
bool IOProcessor::IsTickOnly()
@ -869,9 +869,9 @@ namespace Aurora::IO
void IOProcessor::ReleaseAllWatches()
{
if (asyncWorker)
if (auto optWorker = this->asyncWorker)
{
AuAtomicSub(&AuStaticCast<AuAsync::ThreadPool>(asyncWorker.pool)->uAtomicIOProcessors, 1u);
AuAtomicSub(&AuStaticCast<AuAsync::ThreadPool>(optWorker.value().pool)->uAtomicIOProcessors, 1u);
}
RemoveTimer();

View File

@ -107,7 +107,7 @@ namespace Aurora::IO
IOProcessorItems items;
IOProcessorTimers timers;
AuAsync::WorkerPId_t asyncWorker;
AuOptionalEx<AuAsync::WorkerPId_t> asyncWorker;
AuSPtr<AuAsync::IWorkItem> pWorkItem;
AuThreadPrimitives::MutexUnique_t mutex;

View File

@ -105,7 +105,7 @@ namespace Aurora::IO::Net
AuSPtr<Waiter> temp;
auto pid = AuAsync::GetCurrentWorkerPId();
if (pid)
if (pid.pool)
{
temp = AuMakeShared<Waiter>(work, callback, pid);
}