[*] Symmetry in WoA
This commit is contained in:
parent
073d77a17b
commit
35fb78787d
@ -248,16 +248,17 @@ namespace Aurora::Threading
|
||||
auto pReturn = &tlsWaitEntry;
|
||||
#endif
|
||||
|
||||
pReturn->pBefore = nullptr;
|
||||
pReturn->pNext = nullptr;
|
||||
pReturn->pAddress = pAddress;
|
||||
pReturn->uSize = uSize;
|
||||
|
||||
if (bScheduleFirst /*First in, First Out*/)
|
||||
{
|
||||
Lock();
|
||||
if (!AuExchange(pReturn->bAlive, true))
|
||||
if (!pReturn->bAlive)
|
||||
{
|
||||
pReturn->bAlive = true;
|
||||
pReturn->pBefore = nullptr;
|
||||
pReturn->pNext = nullptr;
|
||||
if (auto pLoadFromMemory = this->waitList.pHead)
|
||||
{
|
||||
pLoadFromMemory->pBefore = pReturn;
|
||||
@ -276,6 +277,9 @@ namespace Aurora::Threading
|
||||
Lock();
|
||||
if (!pReturn->bAlive)
|
||||
{
|
||||
pReturn->bAlive = true;
|
||||
pReturn->pBefore = nullptr;
|
||||
pReturn->pNext = nullptr;
|
||||
if (auto pLoadFromMemory = this->waitList.pTail)
|
||||
{
|
||||
pLoadFromMemory->pNext = pReturn;
|
||||
@ -286,7 +290,6 @@ namespace Aurora::Threading
|
||||
this->waitList.pHead = pReturn;
|
||||
}
|
||||
this->waitList.pTail = pReturn;
|
||||
pReturn->bAlive = true;
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
@ -319,7 +322,6 @@ namespace Aurora::Threading
|
||||
#endif
|
||||
|
||||
auto [bCont, bRemove] = callback(*pCurrentHead);
|
||||
pCurrentHead->bAlive = !bRemove;
|
||||
|
||||
if (bRemove)
|
||||
{
|
||||
@ -349,6 +351,8 @@ namespace Aurora::Threading
|
||||
{
|
||||
pCurrentHead->pNext->pBefore = pCurrentHead->pBefore;
|
||||
}
|
||||
|
||||
pCurrentHead->bAlive = false;
|
||||
}
|
||||
|
||||
if (!bCont)
|
||||
|
Loading…
Reference in New Issue
Block a user