UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ThreadCheckedData.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreGlobals.h"
5#include "ChaosCheck.h"
6
7namespace Chaos
8{
10 template <typename T, typename CheckT>
12 {
13 public:
14
15 template <typename... ArgTs>
16 TThreadCheckedData(ArgTs... Args) : Data(Args...) { }
17
19
20 const T& Get() const
21 {
22 CheckT::CheckRead();
23 return Data;
24 }
25
26 T& Get()
27 {
28 CheckT::CheckReadWrite();
29 return Data;
30 }
31
33 {
34 CheckT::CheckRead();
35 return &Data;
36 }
37
38 const T* operator->() const
39 {
40 CheckT::CheckRead();
41 return &Data;
42 }
43
44 private:
45
46 T Data;
47 };
48
50 {
51 static inline void CheckRead()
52 {
54 }
55
56 static inline void CheckReadWrite()
57 {
59 }
60 };
61
63 {
64 static inline void CheckRead()
65 {
67 }
68
69 static inline void CheckReadWrite()
70 {
71 // TODO: Find a way to check that this code is being executed in
72 // the correct physics thread. This may depend on the threading model.
73 }
74 };
75
76
77 template <typename T>
79
80 template <typename T>
82}
#define CHAOS_CHECK(Condition)
Definition ChaosCheck.h:21
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
CORE_API bool IsInGameThread()
Definition ThreadingBase.cpp:185
This is a wrapper around a piece of data which adds execution thread access checks.
Definition ThreadCheckedData.h:12
const T & Get() const
Definition ThreadCheckedData.h:20
const T * operator->() const
Definition ThreadCheckedData.h:38
T * operator->()
Definition ThreadCheckedData.h:32
~TThreadCheckedData()
Definition ThreadCheckedData.h:18
TThreadCheckedData(ArgTs... Args)
Definition ThreadCheckedData.h:16
T & Get()
Definition ThreadCheckedData.h:26
Definition SkeletalMeshComponent.h:307
Definition ThreadCheckedData.h:50
static void CheckReadWrite()
Definition ThreadCheckedData.h:56
static void CheckRead()
Definition ThreadCheckedData.h:51
Definition ThreadCheckedData.h:63
static void CheckRead()
Definition ThreadCheckedData.h:64
static void CheckReadWrite()
Definition ThreadCheckedData.h:69