[*] Linux stubs

This commit is contained in:
Reece Wilson 2022-04-05 06:59:23 +01:00
parent 48b6994f61
commit d32b84edf4
6 changed files with 175 additions and 12 deletions

View File

@ -19,8 +19,5 @@ namespace Aurora::Loop
bool ILSEvent::IsSignaled() override;
virtual ELoopSource ILSEvent::GetType() override;
bool IsSignaledNonblocking() override;
};
}

View File

@ -2,7 +2,7 @@
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSFromFdNonblocking.cpp
Date: 2022-4-4
Date: 2022-4-5
Author: Reece
***/
#pragma once
@ -15,10 +15,6 @@ namespace Aurora::Loop
bool val {};
source->OnPresleep();
val = ((that).*(IsSignaledNonblocking))();
if (val)
{
val = this->OnTrigger(one);
}
source->OnFinishSleep();
return val;
}

View File

@ -1,8 +1,8 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSSemaphore.Linux.cpp
Date: 2021-10-1
Date: 2022-4-5
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>

View File

@ -1,6 +1,27 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSSemaphore.Linux.hpp
Date: 2022-4-5
Author: Reece
***/
#pragma once
namespace Aurora::Loop
{
struct LSSemaphore : public ILSSemaphore, public LSHandle
{
LSSemaphore(AuUInt32 initialCount);
bool AddOne() override;
virtual bool OnTrigger(AuUInt handle) override;
bool IsSignaled() override;
virtual ELoopSource GetType() override;
private:
void Init(AuUInt32 initialCount);
bool IsSignaledNonblocking();
};
}

View File

@ -1 +1,107 @@
// TODO: io_submit backend
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LoopQueue.Linux.cpp
Date: 2022-4-5
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "Loop.NT.hpp"
#include "ILoopSourceEx.hpp"
#include "LoopQueue.Linux.hpp"
namespace Aurora::Loop
{
// On Linux, Loop Queues are glorified eventfd to epoll adapters.
// Requeuing the cached fd array per frame on the TLS io_submit object
// would be more costly than maintaining an epoll for all fds tracked
// by the loop queue.
// We can delegate the wait functions to an NT overlapped like shim
// where all eventfds are one epoll handle
// The TLS worker would get awoken by any changes in the epoll queue
// or if the io submit object should preemptively abort
// The TLS worker would remain resposible for scheduling thread local
// network and file transactions independent from the loop queues
// As such, loop queues continue to be defined as a mechanism to merely
// wait, not dispatch/manage work
LoopQueue::LoopQueue()
{
}
LoopQueue::~LoopQueue()
{
}
bool LoopQueue::SourceAdd(const AuSPtr<ILoopSource> &source)
{
return {};
}
bool LoopQueue::SourceAddWithTimeout(const AuSPtr<ILoopSource> &source, AuUInt32 ms)
{
return {};
}
bool LoopQueue::SourceRemove(const AuSPtr<ILoopSource> &source)
{
return {};
}
AuUInt32 LoopQueue::GetSourceCount()
{
return {};
}
bool LoopQueue::AddCallback(const AuSPtr<ILoopSource> &source, const AuSPtr<ILoopSourceSubscriber> &subscriber)
{
return {};
}
bool LoopQueue::AddCallbackEx(const AuSPtr<ILoopSource> &source, const AuSPtr<ILoopSourceSubscriberEx> &subscriber)
{
return {};
}
bool LoopQueue::AddCallback(const AuSPtr<ILoopSourceSubscriber> &subscriber)
{
return {};
}
void LoopQueue::ChugPathConfigure(AuUInt32 sectionTickTime, AuSInt sectionDequeCount)
{
}
void LoopQueue::ChugHint(bool value)
{
}
bool LoopQueue::Commit()
{
return {};
}
bool LoopQueue::IsSignaled()
{
return {};
}
bool LoopQueue::WaitAll(AuUInt32 timeout)
{
return {};
}
AuUInt32 LoopQueue::WaitAny(AuUInt32 timeout)
{
return {};
}
AuList<AuSPtr<ILoopSource>> LoopQueue::WaitAnyEx(AuUInt32 timeout)
{
return {};
}
}

View File

@ -0,0 +1,43 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LoopQueue.Linux.hpp
Date: 2022-4-4
Author: Reece
***/
#pragma once
#include "ILoopSourceEx.hpp"
namespace Aurora::Loop
{
struct LoopQueue : ILoopQueue
{
LoopQueue();
~LoopQueue();
bool SourceAdd(const AuSPtr<ILoopSource> &source) override;
bool SourceAddWithTimeout(const AuSPtr<ILoopSource> &source, AuUInt32 ms) override;
bool SourceRemove(const AuSPtr<ILoopSource> &source) override;
AuUInt32 GetSourceCount() override;
virtual bool AddCallback(const AuSPtr<ILoopSource> &source, const AuSPtr<ILoopSourceSubscriber> &subscriber) override;
virtual bool AddCallbackEx(const AuSPtr<ILoopSource> &source, const AuSPtr<ILoopSourceSubscriberEx> &subscriber) override;
virtual bool AddCallback(const AuSPtr<ILoopSourceSubscriber> &subscriber) override;
void ChugPathConfigure(AuUInt32 sectionTickTime, AuSInt sectionDequeCount) override;
void ChugHint(bool value) override;
virtual bool Commit() override;
bool IsSignaled() override;
bool WaitAll(AuUInt32 timeout) override;
AuUInt32 WaitAny(AuUInt32 timeout) override;
AuList<AuSPtr<ILoopSource>> WaitAnyEx(AuUInt32 timeout) override;
private:
};
}