UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Oversubscription.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6
8{
9
11{
12 static thread_local bool bIsOversubscriptionAllowed;
13
15
16 CORE_API static bool& GetIsOversubscriptionAllowedRef();
17
18public:
19 static bool IsOversubscriptionAllowed() { return bIsOversubscriptionAllowed; }
20};
21
23{
25
26public:
27 explicit FOversubscriptionAllowedScope(bool bIsOversubscriptionAllowed)
28 : bValue(FOversubscriptionTls::GetIsOversubscriptionAllowedRef())
29 , bPreviousValue(bValue)
30 {
31 bValue = bIsOversubscriptionAllowed;
32 }
33
35 {
36 bValue = bPreviousValue;
37 }
38
39private:
40 bool& bValue;
41 bool bPreviousValue;
42};
43
44} // LowLevelTasks::Private
45
46namespace LowLevelTasks
47{
48
49class FOversubscriptionScope
50{
51 UE_NONCOPYABLE(FOversubscriptionScope);
52
53public:
54 explicit FOversubscriptionScope(bool bCondition = true)
55 {
56 if (bCondition)
57 {
58 TryIncrementOversubscription();
59 }
60 }
61
62 ~FOversubscriptionScope()
63 {
64 if (bIncrementOversubscriptionEmitted)
65 {
66 DecrementOversubscription();
67 }
68 }
69
70private:
71 CORE_API void TryIncrementOversubscription();
72 CORE_API void DecrementOversubscription();
73
74 bool bIncrementOversubscriptionEmitted = false;
75 bool bCpuBeginEventEmitted = false;
76};
77
78} // LowLevelTests
#define UE_NONCOPYABLE(TypeName)
Definition CoreMiscDefines.h:457
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FOversubscriptionAllowedScope(bool bIsOversubscriptionAllowed)
Definition Oversubscription.h:27
~FOversubscriptionAllowedScope()
Definition Oversubscription.h:34
Definition Oversubscription.h:11
static bool IsOversubscriptionAllowed()
Definition Oversubscription.h:19
Definition WaitingQueue.cpp:76
Definition Scheduler.cpp:25