UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ExternalMutex.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreTypes.h"
7
8#include <atomic>
9
10namespace UE
11{
12
22template <CIntrusiveMutexParams ParamsType>
23class TExternalMutex final
24{
26
27public:
30
31 inline constexpr explicit TExternalMutex(std::atomic<StateType>& InState)
32 : State(InState)
33 {
34 }
35
36 [[nodiscard]] inline bool IsLocked() const
37 {
39 }
40
41 [[nodiscard]] inline bool TryLock()
42 {
44 }
45
46 inline void Lock()
47 {
49 }
50
51 inline void Unlock()
52 {
54 }
55
56private:
57 std::atomic<StateType>& State;
58};
59
60namespace Core::Private
61{
62
63struct FExternalMutexParams
64{
65 inline constexpr static uint8 IsLockedFlag = 1 << 0;
66 inline constexpr static uint8 MayHaveWaitingLockFlag = 1 << 1;
67};
68
69} // Core::Private
70
71using FExternalMutex UE_DEPRECATED(5.7, "Use TExternalMutex or TIntrusiveMutex.") = TExternalMutex<Core::Private::FExternalMutexParams>;
72
73} // UE
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ExternalMutex.h:24
bool TryLock()
Definition ExternalMutex.h:41
bool IsLocked() const
Definition ExternalMutex.h:36
constexpr TExternalMutex(std::atomic< StateType > &InState)
Definition ExternalMutex.h:31
void Unlock()
Definition ExternalMutex.h:51
void Lock()
Definition ExternalMutex.h:46
TExternalMutex & operator=(const TExternalMutex &)=delete
TExternalMutex(const TExternalMutex &)=delete
Definition AdvancedWidgetsModule.cpp:13
std::decay_t< decltype(ParamsType::IsLockedFlag)> TIntrusiveMutexStateType_T
Definition IntrusiveMutex.h:19