I need a code example for using unreal's mutex!

Hi, I want just two lines of code example of creating and locking a mutex in UE4 way.

I think FCriticalSection is the mutex type inside of UE4, but I don’t know how to use a function like C++ standard lock_guard. (In standard C++ this function is superior to using lock(), then unlock() if an exception was thrown amid locking, is that the case with unreal as well?)

The code of standard c++ that I’d like to replicate using unreal coding standard is the following:

#include <mutex>
std::mutex GlobalMutex;
foo()
{
std::lock_guard<std::mutex> lock(GlobalMutex);
//...
//rest of code.
//...
}
1 Like

did u find that out ?

FScopeLock