are Critical sections working in UE5 ?

I’m currently working on UE 5 EA2 on Windows 10 using VS 2019 with C++17.

I have a weird behaviour regarding FCriticalSection.

I created an empty project and added this piece of code in the BeginPlay() of a custom actor.

	FCriticalSection cs;


	if (cs.TryLock()) {
		UE_LOG(LogTemp, Warning, TEXT("I can re-lock the critical section"))
	else {
		UE_LOG(LogTemp, Warning, TEXT("I can't re-lock the critical section"))

And it appears we can lock twice (and more) a FCriticalSection without unlocking it …

Am I missing something on the purpose of a FCriticalSection or how to use it, or is it a bug ?


Guess the locking is uselss because it is trying on the same thread. system thread might check the thread id before try locking it.