[*] Readd the public symbols to create base kernel io primitives for interop
This commit is contained in:
parent
ce1ae24506
commit
aa811f93aa
@ -18,7 +18,7 @@
|
||||
#include "ILoopQueue.hpp"
|
||||
|
||||
namespace Aurora::IO::Loop
|
||||
{
|
||||
{
|
||||
// optTimeoutMS = {} | indefinite
|
||||
// optTimeoutMS = 0 | poll
|
||||
// optTimeoutMS = 1 | 1ms
|
||||
@ -41,27 +41,27 @@ namespace Aurora::IO::Loop
|
||||
virtual bool AddOne() = 0;
|
||||
virtual bool AddMany(AuUInt32 uCount) = 0;
|
||||
};
|
||||
|
||||
|
||||
struct ILSEvent : virtual ILoopSource
|
||||
{
|
||||
virtual bool Set() = 0;
|
||||
virtual bool Reset() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct ILSMutex : virtual ILoopSource
|
||||
{
|
||||
virtual bool Unlock() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct IConditionVar : virtual ILoopSource
|
||||
{
|
||||
virtual bool Signal() = 0;
|
||||
virtual bool Broadcast() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct ITimer : virtual ILoopSource
|
||||
{
|
||||
/* Warning: IO timers use wall time (CurrentClock[M/NS), not SteadyClock[M/N]S()).
|
||||
/* Warning: IO timers use wall time (CurrentClock[M/NS), not SteadyClock[M/N]S()).
|
||||
Use auasync timers for steady-clock timing and tick timing information. */
|
||||
|
||||
virtual void UpdateTime(AuUInt64 absTimeMs) = 0;
|
||||
@ -75,11 +75,14 @@ namespace Aurora::IO::Loop
|
||||
{
|
||||
virtual void *GetLastSignalInfo() = 0;
|
||||
};
|
||||
|
||||
|
||||
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)
|
||||
@ -100,11 +110,14 @@ namespace Aurora::IO::Loop
|
||||
return NewLSOSHandle(ConnectionNumber(display));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||
static AuSPtr<ILoopSource> NewLSFd(int fd)
|
||||
{
|
||||
if (fd > 0) return {};
|
||||
if (fd < 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
return NewLSOSHandle(fd);
|
||||
}
|
||||
#endif
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user