You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Use exchange instead of CAS to gain ownership of the linked list of new trace events.
#rb johan.berg #rnx [CL 15872372 by Martin Ridgers in ue5-main branch]
This commit is contained in:
@@ -40,18 +40,12 @@ const FEventNode* FEventNode::FIter::GetNext()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
FEventNode::FIter FEventNode::ReadNew()
|
||||
{
|
||||
FEventNode* EventList = AtomicLoadRelaxed(&GNewEventList);
|
||||
FEventNode* EventList = AtomicExchangeAcquire(&GNewEventList, (FEventNode*)nullptr);
|
||||
if (EventList == nullptr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
while (!AtomicCompareExchangeAcquire(&GNewEventList, (FEventNode*)nullptr, EventList))
|
||||
{
|
||||
PlatformYield();
|
||||
EventList = AtomicLoadRelaxed(&GNewEventList);
|
||||
}
|
||||
|
||||
if (GEventListHead == nullptr)
|
||||
{
|
||||
GEventListHead = EventList;
|
||||
@@ -187,15 +181,7 @@ void FEventNode::OnConnect()
|
||||
return;
|
||||
}
|
||||
|
||||
for (;; PlatformYield())
|
||||
{
|
||||
FEventNode* Node = AtomicLoadRelaxed(&GNewEventList);
|
||||
if (AtomicCompareExchangeRelaxed(&GNewEventList, GEventListHead, Node))
|
||||
{
|
||||
GEventListTail->Next = Node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
GEventListTail->Next = AtomicExchangeAcquire(&GNewEventList, GEventListHead);
|
||||
|
||||
GEventListHead = GEventListTail = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user