template<
typename MutexType>
class UE::TScopeTryLock< MutexType >
RAII-style scope locking of a synchronization primitive using TryLock. MutexType must be a type like UE::FMutex or FCriticalSection which implements TryLock and Unlock methods.
{ // Try to acquire a lock on Mutex for the current scope. UE::TScopeTryLock ScopeTryLock(Mutex);
// Check that the lock was acquired. if (ScopeTryLock.IsLocked()) { // If the lock was acquired, we can safely access resources protected // by the mutex. }
// When ScopeTryLock goes out of scope, the mutex will be released if it was // ever acquired. }