[*] ...same applies to these
This commit is contained in:
parent
87c3ac790d
commit
7680a86d5a
@ -118,14 +118,15 @@ namespace Aurora::Threading::Primitives
|
|||||||
AuUInt32 uWaiters {};
|
AuUInt32 uWaiters {};
|
||||||
|
|
||||||
uWaiters = AuAtomicLoad(&this->uWaiters_);
|
uWaiters = AuAtomicLoad(&this->uWaiters_);
|
||||||
if (uWaiters > 0)
|
if (uWaiters == 0)
|
||||||
{
|
{
|
||||||
this->s_.Unlock();
|
return;
|
||||||
uWaitCount = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->s_.Unlock();
|
||||||
|
|
||||||
while (uWaiters &&
|
while (uWaiters &&
|
||||||
AuAtomicCompareExchange(&this->uWaiters_, uWaiters - uWaitCount, uWaiters) != uWaiters)
|
AuAtomicCompareExchange(&this->uWaiters_, uWaiters - 1u, uWaiters) != uWaiters)
|
||||||
{
|
{
|
||||||
uWaiters = this->uWaiters_;
|
uWaiters = this->uWaiters_;
|
||||||
|
|
||||||
|
@ -135,19 +135,19 @@ namespace Aurora::Threading::Primitives
|
|||||||
|
|
||||||
void ConditionVariableLinux::Signal()
|
void ConditionVariableLinux::Signal()
|
||||||
{
|
{
|
||||||
AuUInt32 uWaitCount {};
|
|
||||||
AuUInt32 uWaiters {};
|
AuUInt32 uWaiters {};
|
||||||
|
|
||||||
uWaiters = AuAtomicLoad(&this->uSleeping_);
|
uWaiters = AuAtomicLoad(&this->uSleeping_);
|
||||||
if (uWaiters > 0)
|
if (uWaiters == 0)
|
||||||
{
|
{
|
||||||
AuAtomicAdd(&this->uState_, 1u);
|
return;
|
||||||
futex_wake(&this->uState_, 1u);
|
|
||||||
uWaitCount = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AuAtomicAdd(&this->uState_, 1u);
|
||||||
|
futex_wake(&this->uState_, 1u);
|
||||||
|
|
||||||
while (uWaiters &&
|
while (uWaiters &&
|
||||||
AuAtomicCompareExchange(&this->uSleeping_, uWaiters - uWaitCount, uWaiters) != uWaiters)
|
AuAtomicCompareExchange(&this->uSleeping_, uWaiters - 1u, uWaiters) != uWaiters)
|
||||||
{
|
{
|
||||||
uWaiters = this->uSleeping_;
|
uWaiters = this->uSleeping_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user