AuroraRuntime/Source/Async/Async.cpp

78 lines
1.4 KiB
C++
Raw Permalink Normal View History

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Async.cpp
Date: 2021-6-26
Author: Reece
***/
2021-09-30 14:57:41 +00:00
#include <Source/RuntimeInternal.hpp>
2021-06-27 21:25:29 +00:00
#include "Async.hpp"
#include "AuSchedular.hpp"
#include "AsyncApp.hpp"
2021-06-27 21:25:29 +00:00
namespace Aurora::Async
{
void InitAsync()
{
2021-06-30 12:00:32 +00:00
InitSched();
InitApp();
2021-06-30 12:00:32 +00:00
}
2021-06-27 21:25:29 +00:00
void ShutdownAsync()
2021-06-30 12:00:32 +00:00
{
DeinitSched();
ReleaseApp();
2021-06-27 21:25:29 +00:00
}
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 {};
}
}
2021-06-27 21:25:29 +00:00
}