[*] Added timeout awareness in ConditionEx; returns false on timeout

[*] Updated Linux SOO sizes
This commit is contained in:
Reece Wilson 2023-08-12 11:18:19 +01:00
parent 7962772c62
commit 6ec2fcc4b6
3 changed files with 22 additions and 20 deletions

View File

@ -21,9 +21,9 @@ namespace Aurora::Threading::Primitives
virtual void WaitForSignal(IWaitable *pWaitable) = 0;
virtual void WaitForSignal(const AuSPtr<IWaitable> &pWaitable) = 0;
virtual void WaitForSignalNS(AuUInt64 uRelativeNanoseconds) = 0;
virtual void WaitForSignalNS(IWaitable *pWaitable, AuUInt64 uRelativeNanoseconds) = 0;
virtual void WaitForSignalNS(const AuSPtr<IWaitable> &pWaitable, AuUInt64 uRelativeNanoseconds) = 0;
virtual bool WaitForSignalNS(AuUInt64 uRelativeNanoseconds) = 0;
virtual bool WaitForSignalNS(IWaitable *pWaitable, AuUInt64 uRelativeNanoseconds) = 0;
virtual bool WaitForSignalNS(const AuSPtr<IWaitable> &pWaitable, AuUInt64 uRelativeNanoseconds) = 0;
virtual void Broadcast() = 0;
virtual void Signal() = 0;

View File

@ -37,19 +37,19 @@ namespace Aurora::Threading::Primitives
static const auto kPrimitiveSize64LinuxMutex = 16;
static const auto kPrimitiveSize64LinuxSemaphore = 16;
static const auto kPrimitiveSize64LinuxCS = 128;
static const auto kPrimitiveSize64LinuxEvent = 152;
static const auto kPrimitiveSize64LinuxRWLock = 200;
static const auto kPrimitiveSize64LinuxCond = 88;
static const auto kPrimitiveSize64LinuxCondMutex = 48;
static const auto kPrimitiveSize64LinuxCS = 40;
static const auto kPrimitiveSize64LinuxEvent = 80;
static const auto kPrimitiveSize64LinuxRWLock = 88;
static const auto kPrimitiveSize64LinuxCond = 48;
static const auto kPrimitiveSize64LinuxCondMutex = 16;
static const auto kPrimitiveSize32LinuxMutex = 8;
static const auto kPrimitiveSize32LinuxSemaphore = 8;
static const auto kPrimitiveSize32LinuxCS = 128;
static const auto kPrimitiveSize32LinuxEvent = 152;
static const auto kPrimitiveSize32LinuxRWLock = 200;
static const auto kPrimitiveSize32LinuxCond = 88;
static const auto kPrimitiveSize32LinuxCondMutex = 48;
static const auto kPrimitiveSize32LinuxCS = 40;
static const auto kPrimitiveSize32LinuxEvent = 80;
static const auto kPrimitiveSize32LinuxRWLock = 88;
static const auto kPrimitiveSize32LinuxCond = 48;
static const auto kPrimitiveSize32LinuxCondMutex = 16;
// TODO: Other platforms...

View File

@ -19,9 +19,9 @@ namespace Aurora::Threading::Primitives
void WaitForSignal(const AuSPtr<IWaitable> &pWaitable) override;
void WaitForSignal() override;
void WaitForSignalNS(AuUInt64 uRelativeNanoseconds) override;
void WaitForSignalNS(IWaitable *waitable, AuUInt64 uRelativeNanoseconds) override;
void WaitForSignalNS(const AuSPtr<IWaitable> &waitable, AuUInt64 uRelativeNanoseconds) override;
bool WaitForSignalNS(AuUInt64 uRelativeNanoseconds) override;
bool WaitForSignalNS(IWaitable *waitable, AuUInt64 uRelativeNanoseconds) override;
bool WaitForSignalNS(const AuSPtr<IWaitable> &waitable, AuUInt64 uRelativeNanoseconds) override;
void Signal() override;
void Broadcast() override;
@ -38,18 +38,18 @@ namespace Aurora::Threading::Primitives
}
void SemaphoreConditionVariableImpl::WaitForSignalNS(AuUInt64 uRelativeNanoseconds)
bool SemaphoreConditionVariableImpl::WaitForSignalNS(AuUInt64 uRelativeNanoseconds)
{
WaitForSignalNS(nullptr, uRelativeNanoseconds);
return WaitForSignalNS(nullptr, uRelativeNanoseconds);
}
void SemaphoreConditionVariableImpl::WaitForSignalNS(IWaitable *pWaitable, AuUInt64 uRelativeNanoseconds)
bool SemaphoreConditionVariableImpl::WaitForSignalNS(IWaitable *pWaitable, AuUInt64 uRelativeNanoseconds)
{
return WaitForSignalNS(pWaitable ? AuUnsafeRaiiToShared(pWaitable) : AuSPtr<IWaitable> {},
uRelativeNanoseconds);
}
void SemaphoreConditionVariableImpl::WaitForSignalNS(const AuSPtr<IWaitable> &pWaitable,
bool SemaphoreConditionVariableImpl::WaitForSignalNS(const AuSPtr<IWaitable> &pWaitable,
AuUInt64 uRelativeNanoseconds)
{
AuAtomicAdd(&this->uWaiters_, 1u);
@ -80,6 +80,8 @@ namespace Aurora::Threading::Primitives
{
pWaitable->Lock();
}
return bSuccess;
}
void SemaphoreConditionVariableImpl::WaitForSignal(IWaitable *pWaitable)