2021-06-27 21:33:58 +00:00
|
|
|
/***
|
|
|
|
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"
|
2023-11-11 10:11:09 +00:00
|
|
|
#include "AuSchedular.hpp"
|
2021-11-05 17:34:23 +00:00
|
|
|
#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();
|
2021-11-05 17:34:23 +00:00
|
|
|
InitApp();
|
2021-06-30 12:00:32 +00:00
|
|
|
}
|
2021-06-27 21:25:29 +00:00
|
|
|
|
2021-07-01 09:18:42 +00:00
|
|
|
void ShutdownAsync()
|
2021-06-30 12:00:32 +00:00
|
|
|
{
|
2021-07-15 16:16:23 +00:00
|
|
|
DeinitSched();
|
2021-11-05 17:34:23 +00:00
|
|
|
ReleaseApp();
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
2024-07-12 16:22:07 +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
|
|
|
}
|