removed assert if ticker's delegate is removed multiple times

#jira UE-124560
#rb francis.hurteau vincent.gauthier

#ROBOMERGE-SOURCE: CL 17380188 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17380196 by andriy tylychko in ue5-release-engine-test branch]
This commit is contained in:
andriy tylychko
2021-08-31 19:46:16 -04:00
parent fa91b23a32
commit 19daea88b2
2 changed files with 8 additions and 2 deletions
@@ -34,9 +34,8 @@ void FTSTicker::RemoveTicker(FDelegateHandle Handle)
if (FElementPtr Element = Handle.Pin())
{
// mark the element as removed and if it's being ticked atm, spin-wait until its execution is finished
uint64 PrevState = Element->State.fetch_add(FElement::RemovedState, std::memory_order_acquire); // "acquire" to prevent potential
uint64 PrevState = Element->State.fetch_or(FElement::RemovedState, std::memory_order_acquire); // "acquire" to prevent potential
// resource release after RemoveTicker() to be reordered before it
checkf((PrevState & 0x1) == FElement::DefaultState, TEXT("The delegate is already removed (%u)"), PrevState);
uint32 ExecutingThreadId = GetThreadId(PrevState);
while (ExecutingThreadId != 0 && // is being executed right now