Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FScopeTryLock Class Reference

#include <ScopeTryLock.h>

+ Collaboration diagram for FScopeTryLock:

Public Member Functions

 FScopeTryLock (FCriticalSection *InCriticalSection)
 
 ~FScopeTryLock ()
 
FORCEINLINE bool IsLocked () const
 

Private Member Functions

 FScopeTryLock (FScopeTryLock const &InScopeLock)=delete
 
FScopeTryLockoperator= (FScopeTryLock &Rhs)=delete
 

Private Attributes

FCriticalSectionCriticalSection
 

Detailed Description

Implements a scope lock using TryLock.

This is a utility class that handles scope level locking using TryLock. Scope locking helps to avoid programming errors by which a lock is acquired and never released.

{ // Try to acquire a lock on CriticalSection for the current scope. FScopeTryLock ScopeTryLock(CriticalSection); // Check that the lock was acquired. if (ScopeTryLock.IsLocked()) { // If the lock was acquired, we can safely access resources protected // by the lock. } // When ScopeTryLock goes out of scope, the critical section will be // released if it was ever acquired. }

Definition at line 31 of file ScopeTryLock.h.

Constructor & Destructor Documentation

◆ FScopeTryLock() [1/2]

FScopeTryLock::FScopeTryLock ( FCriticalSection * InCriticalSection)
inline

Definition at line 36 of file ScopeTryLock.h.

+ Here is the call graph for this function:

◆ ~FScopeTryLock()

FScopeTryLock::~FScopeTryLock ( )
inline

Definition at line 47 of file ScopeTryLock.h.

+ Here is the call graph for this function:

◆ FScopeTryLock() [2/2]

FScopeTryLock::FScopeTryLock ( FScopeTryLock const & InScopeLock)
privatedelete

Member Function Documentation

◆ IsLocked()

FORCEINLINE bool FScopeTryLock::IsLocked ( ) const
inline

Definition at line 55 of file ScopeTryLock.h.

◆ operator=()

FScopeTryLock & FScopeTryLock::operator= ( FScopeTryLock & Rhs)
privatedelete

Member Data Documentation

◆ CriticalSection

FCriticalSection* FScopeTryLock::CriticalSection
private

Definition at line 64 of file ScopeTryLock.h.


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