UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ThreadSafeBool.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"
7
9// DEPRECATED. Please use `std::atomic<bool>`
11
16 : private FThreadSafeCounter
17{
18public:
23 FThreadSafeBool(bool bValue = false)
24 : FThreadSafeCounter(bValue ? 1 : 0)
25 {}
26
30 UE_FORCEINLINE_HINT operator bool() const
31 {
32 return GetValue() != 0;
33 }
34
38 inline bool operator=(bool bNewValue)
39 {
40 Set(bNewValue ? 1 : 0);
41 return bNewValue;
42 }
43
51 {
52 return Set(bNewValue ? 1 : 0) != 0;
53 }
54};
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
Definition ThreadSafeBool.h:17
UE_FORCEINLINE_HINT bool AtomicSet(bool bNewValue)
Definition ThreadSafeBool.h:50
bool operator=(bool bNewValue)
Definition ThreadSafeBool.h:38
FThreadSafeBool(bool bValue=false)
Definition ThreadSafeBool.h:23
Definition ThreadSafeCounter.h:14
int32 GetValue() const
Definition ThreadSafeCounter.h:120