[*] Readd the public symbols to create base kernel io primitives for interop

This commit is contained in:
Reece Wilson 2024-01-03 17:24:34 +00:00
parent ce1ae24506
commit aa811f93aa
7 changed files with 34 additions and 33 deletions

View File

@ -78,8 +78,11 @@ namespace Aurora::IO::Loop
AUKN_SYM AuSPtr<ITimer> NewLSTimer(AuUInt64 absStartTimeMs /*CurrentClockMS()*/, AuUInt32 reschedStepMsOrZero = 0, AuUInt32 maxIterationsOrZero = 0, bool bSingleshot = false /*cannot be changed*/);
AUKN_SYM AuSPtr<ILSMutex> NewLSMutex();
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool triggerd = false, bool atomicRelease = true, bool permitMultipleTriggers = false);
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphore(AuUInt32 initialCount = 0);
AUKN_SYM AuSPtr<ILSMutex> NewLSMutexSlow(); // interop-ready (usable with DbgLoopSourceToReadFd)
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool bTriggered = false, bool bAtomicRelease = true, bool bPermitMultipleTriggers = false);
AUKN_SYM AuSPtr<ILSEvent> NewLSEventSlow(bool bTriggered = false, bool bAtomicRelease = true, bool bPermitMultipleTriggers = false); // interop-ready (usable with DbgLoopSourceToReadFd)
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphore(AuUInt32 uInitialCount = 0);
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphoreSlow(AuUInt32 uInitialCount = 0); // interop-ready (usable with DbgLoopSourceToReadFd)
AUKN_SYM AuSPtr<ILoopSource> NewLSOSHandle(AuUInt);
AUKN_SYM AuSPtr<ILoopSource> NewLSAsync(Async::WorkerPId_t workerPid);
AUKN_SYM AuSPtr<ILoopSource> NewLSFile(const AuSPtr<IO::IAsyncTransaction> &fileTransaction);
@ -88,10 +91,17 @@ namespace Aurora::IO::Loop
AUKN_SYM AuSPtr<ILoopSource> NewLSAppleSource();
AUKN_SYM AuSPtr<ILoopSource> NewLSIOHandle(const AuSPtr<IIOHandle> &pHandle);
// warn: only works on singular loop sources
// warn: Only works on singular loop sources
// warn: You should only use trust the interop-ready sources to serve the HANDLE/fd you expect.
// The primary loop-source primitives are capable of bypassing the kernels io scheduler via in-process atomics.
// These can be leveraged AuLoop::WaitMultipleLoopSources with kWaitMultipleFlagAvoidKern and future planned ILoopSource methods.
// For scheduling io events, the atomic optimizations are pointless. They can, however, serve to deduplicate multiple event triggers
// and optimize the wait-on operation of win32-on-unix/win32 emulators.
// In addition, D3D, Winsock, NT IO, and other subsystems of a modern coreos system expects (or at least, are documented to expect)
// kernel event handle objects for synchronization - not semaphores with some atomic word in a process god knows where.
AUKN_SYM AuInt64 DbgLoopSourceToReadFd(AuSPtr<ILoopSource> pLoopSource);
// warn: only works on singular loop sources
// warn: Only works on singular loop sources
AUKN_SYM AuInt64 DbgLoopSourceToWriteFd(AuSPtr<ILoopSource> pLoopSource);
#if defined(X_PROTOCOL)
@ -104,7 +114,10 @@ namespace Aurora::IO::Loop
#if defined(AURORA_IS_POSIX_DERIVED)
static AuSPtr<ILoopSource> NewLSFd(int fd)
{
if (fd > 0) return {};
if (fd < 0)
{
return {};
}
return NewLSOSHandle(fd);
}
#endif

View File

@ -123,10 +123,9 @@ namespace Aurora::IO::Loop
return ELoopSource::eSourceEvent;
}
#if 0
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool triggered, bool atomicRelease, bool permitMultipleTriggers)
AUKN_SYM AuSPtr<ILSEvent> NewLSEventSlow(bool bTriggered, bool bAtomicRelease, bool bPermitMultipleTriggers)
{
auto event = AuMakeShared<LSEvent>(triggered, atomicRelease, permitMultipleTriggers);
auto event = AuMakeShared<LSEvent>(bTriggered, bAtomicRelease, bPermitMultipleTriggers);
if (!event)
{
return {};
@ -139,5 +138,4 @@ namespace Aurora::IO::Loop
return event;
}
#endif
}

View File

@ -65,12 +65,11 @@ namespace Aurora::IO::Loop
return ELoopSource::eSourceEvent;
}
#if 0
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool triggerd, bool atomicRelease, bool permitMultipleTriggers)
AUKN_SYM AuSPtr<ILSEvent> NewLSEventSlow(bool bTriggered, bool bAtomicRelease, bool bPermitMultipleTriggers)
{
AuSPtr<LSEvent> ret;
if (!(ret = AuMakeShared<LSEvent>(triggerd, atomicRelease, permitMultipleTriggers)))
if (!(ret = AuMakeShared<LSEvent>(bTriggered, bAtomicRelease, bPermitMultipleTriggers)))
{
return {};
}
@ -82,5 +81,4 @@ namespace Aurora::IO::Loop
return ret;
}
#endif
}

View File

@ -91,8 +91,7 @@ namespace Aurora::IO::Loop
return ELoopSource::eSourceMutex;
}
#if 0
AUKN_SYM AuSPtr<ILSMutex> NewLSMutex()
AUKN_SYM AuSPtr<ILSMutex> NewLSMutexSlow()
{
auto pMutex = AuMakeShared<LSMutex>();
if (!pMutex)
@ -107,5 +106,4 @@ namespace Aurora::IO::Loop
return pMutex;
}
#endif
}

View File

@ -40,8 +40,7 @@ namespace Aurora::IO::Loop
return ELoopSource::eSourceMutex;
}
#if 0
AUKN_SYM AuSPtr<ILSMutex> NewLSMutex()
AUKN_SYM AuSPtr<ILSMutex> NewLSMutexSlow()
{
AuSPtr<ILSMutex> ret;
@ -54,5 +53,4 @@ namespace Aurora::IO::Loop
return AuMakeShared<LSMutex>(mutex);
}
#endif
}

View File

@ -98,8 +98,7 @@ namespace Aurora::IO::Loop
return ELoopSource::eSourceSemaphore;
}
#if 0
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphore(AuUInt32 initialCount)
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphoreSlow(AuUInt32 initialCount)
{
auto pSemaphore = AuMakeShared<LSSemaphore>(initialCount);
if (!pSemaphore)
@ -114,5 +113,4 @@ namespace Aurora::IO::Loop
return pSemaphore;
}
#endif
}

View File

@ -63,8 +63,7 @@ namespace Aurora::IO::Loop
return true;
}
#if 0
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphore(AuUInt32 initialCount)
AUKN_SYM AuSPtr<ILSSemaphore> NewLSSemaphoreSlow(AuUInt32 initialCount)
{
AuSPtr<LSSemaphore> ret;
@ -77,5 +76,4 @@ namespace Aurora::IO::Loop
return AuMakeShared<LSSemaphore>(semaphore);
}
#endif
}