UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::TScopeTryLock< MutexType > Class Template Reference

#include <ScopeTryLock.h>

Public Member Functions

 TScopeTryLock (MutexType &InMutex)
 
 ~TScopeTryLock ()
 
UE_FORCEINLINE_HINT bool IsLocked ()
 

Detailed Description

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. }

Constructor & Destructor Documentation

◆ TScopeTryLock()

template<typename MutexType >
UE::TScopeTryLock< MutexType >::TScopeTryLock ( MutexType &  InMutex)
inlineexplicit

◆ ~TScopeTryLock()

template<typename MutexType >
UE::TScopeTryLock< MutexType >::~TScopeTryLock ( )
inline

Member Function Documentation

◆ IsLocked()

template<typename MutexType >
UE_FORCEINLINE_HINT bool UE::TScopeTryLock< MutexType >::IsLocked ( )
inline

The documentation for this class was generated from the following file: