AuroraRuntime/Source/Async/Async.cpp
Jamie Reece Wilson d803f1547c [+] Added AuAsync per thread io group singleton
[*] Move static functions out of the thread pool interface. no idea how i had successful builds before
2024-07-12 17:22:07 +01:00

78 lines
1.4 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Async.cpp
Date: 2021-6-26
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "Async.hpp"
#include "AuSchedular.hpp"
#include "AsyncApp.hpp"
namespace Aurora::Async
{
void InitAsync()
{
InitSched();
InitApp();
}
void ShutdownAsync()
{
DeinitSched();
ReleaseApp();
}
AuSPtr<IO::IIOProcessor> GetSelfIOProcessor()
{
auto pid = GetCurrentWorkerPId();
if (pid)
{
return pid.GetPool()->GetIOProcessor(pid);
}
else
{
return {};
}
}
AuSPtr<IO::Net::INetInterface> GetSelfIONetInterface()
{
auto pid = GetCurrentWorkerPId();
if (pid)
{
return pid.GetPool()->GetIONetInterface(pid);
}
else
{
return {};
}
}
AuSPtr<IO::Net::INetWorker> GetSelfIONetWorker()
{
auto pid = GetCurrentWorkerPId();
if (pid)
{
return pid.GetPool()->GetIONetWorker(pid);
}
else
{
return {};
}
}
AuSPtr<IO::CompletionGroup::ICompletionGroup> GetSelfIOGroup()
{
auto pid = GetCurrentWorkerPId();
if (pid)
{
return pid.GetPool()->GetIOGroup(pid);
}
else
{
return {};
}
}
}