UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TransactionallySafeRWLock.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "AutoRTFM.h"
6
7#if UE_AUTORTFM
9#else
10#include "HAL/CriticalSection.h"
11#endif // UE_AUTORTFM
12
13
14#if UE_AUTORTFM
15
16// Transactionally-safe RWLocks are implemented in terms of FTransactionallySafeSharedMutex.
17// Unfortunately, the method names differ slightly between RWLock and SharedMutex, so we adapt the names here.
19{
20private:
22
23public:
24 void ReadLock()
25 {
26 Super::LockShared();
27 }
28
29 void ReadUnlock()
30 {
31 Super::UnlockShared();
32 }
33
34 void WriteLock()
35 {
36 Super::Lock();
37 }
38
39 void WriteUnlock()
40 {
41 Super::Unlock();
42 }
43
44 bool TryWriteLock()
45 {
46 return Super::TryLock();
47 }
48};
49
50#else
52#endif
UE::FPlatformRWLock FRWLock
Definition CriticalSection.h:56
Definition CriticalSection.h:14
Definition SharedMutex.h:22
::UE::FSharedMutex FTransactionallySafeSharedMutex
Definition TransactionallySafeSharedMutex.h:202