UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
WindowsPlatformMutex.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#include "Misc/Timespan.h"
8
9class FString;
10
11namespace UE
12{
13
20{
21public:
24
26 {
27 CA_SUPPRESS(28125);
29 }
30
35
37 {
38 return !!Windows::TryEnterCriticalSection(&CriticalSection);
39 }
40
42 {
43 Windows::EnterCriticalSection(&CriticalSection);
44 }
45
47 {
48 Windows::LeaveCriticalSection(&CriticalSection);
49 }
50
51private:
52 Windows::CRITICAL_SECTION CriticalSection;
53};
54
63{
64public:
67
69
71 {
72 checkf(!IsLocked(), TEXT("Destroying a lock that is still held!"));
73 }
74
79
84
89
94
99
104
105private:
106 bool IsLocked()
107 {
109 {
111 return false;
112 }
113 return true;
114 }
115
116 Windows::SRWLOCK Mutex = { 0 }; // SRWLOCK_INIT
117};
118
121{
122public:
125
127 CORE_API explicit FWindowsSystemWideMutex(const FString& InName, FTimespan InTimeout = FTimespan::Zero());
128
131
137 CORE_API bool IsValid() const;
138
140 CORE_API void Release();
141
142private:
143 Windows::HANDLE Mutex;
144};
145
149
150} // UE
151
152#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_6
153#include "HAL/PlatformMemory.h"
154#endif
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define CA_SUPPRESS(WarningNumber)
Definition CoreMiscDefines.h:125
#define TEXT(x)
Definition Platform.h:1272
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition GenericPlatformMutex.h:62
Definition WindowsPlatformMutex.h:20
UE_FORCEINLINE_HINT void Unlock()
Definition WindowsPlatformMutex.h:46
FWindowsRecursiveMutex & operator=(const FWindowsRecursiveMutex &)=delete
UE_FORCEINLINE_HINT void Lock()
Definition WindowsPlatformMutex.h:41
UE_FORCEINLINE_HINT ~FWindowsRecursiveMutex()
Definition WindowsPlatformMutex.h:31
FWindowsRecursiveMutex()
Definition WindowsPlatformMutex.h:25
FWindowsRecursiveMutex(const FWindowsRecursiveMutex &)=delete
UE_FORCEINLINE_HINT bool TryLock()
Definition WindowsPlatformMutex.h:36
Definition WindowsPlatformMutex.h:63
UE_FORCEINLINE_HINT void UnlockShared()
Definition WindowsPlatformMutex.h:100
UE_FORCEINLINE_HINT void LockShared()
Definition WindowsPlatformMutex.h:95
~FWindowsSharedMutex()
Definition WindowsPlatformMutex.h:70
UE_FORCEINLINE_HINT void Lock()
Definition WindowsPlatformMutex.h:80
UE_FORCEINLINE_HINT void Unlock()
Definition WindowsPlatformMutex.h:85
FWindowsSharedMutex(const FWindowsSharedMutex &)=delete
UE_FORCEINLINE_HINT bool TryLock()
Definition WindowsPlatformMutex.h:75
UE_FORCEINLINE_HINT bool TryLockShared()
Definition WindowsPlatformMutex.h:90
FWindowsSharedMutex & operator=(const FWindowsSharedMutex &)=delete
Definition WindowsPlatformMutex.h:121
FWindowsSystemWideMutex & operator=(const FWindowsSystemWideMutex &)=delete
CORE_API void Release()
Definition WindowsPlatformMutex.cpp:69
FWindowsSystemWideMutex(const FWindowsSystemWideMutex &)=delete
CORE_API bool IsValid() const
Definition WindowsPlatformMutex.cpp:64
CORE_API ~FWindowsSystemWideMutex()
Definition WindowsPlatformMutex.cpp:59
Definition AdvancedWidgetsModule.cpp:13
FPThreadsRecursiveMutex FPlatformRecursiveMutex
Definition AndroidPlatformMutex.h:12
FPThreadsSharedMutex FPlatformSharedMutex
Definition AndroidPlatformMutex.h:13
MINIMAL_WINDOWS_API void WINAPI AcquireSRWLockExclusive(PSRWLOCK SRWLock)
MINIMAL_WINDOWS_API void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
MINIMAL_WINDOWS_API BOOLEAN WINAPI TryAcquireSRWLockShared(PSRWLOCK SRWLock)
MINIMAL_WINDOWS_API BOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
MINIMAL_WINDOWS_API BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount)
MINIMAL_WINDOWS_API void WINAPI AcquireSRWLockShared(PSRWLOCK SRWLock)
void * HANDLE
Definition MinimalWindowsApi.h:78
MINIMAL_WINDOWS_API void WINAPI ReleaseSRWLockShared(PSRWLOCK SRWLock)
MINIMAL_WINDOWS_API BOOLEAN WINAPI TryAcquireSRWLockExclusive(PSRWLOCK SRWLock)
MINIMAL_WINDOWS_API void WINAPI ReleaseSRWLockExclusive(PSRWLOCK SRWLock)
MINIMAL_WINDOWS_API void WINAPI EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
MINIMAL_WINDOWS_API void WINAPI DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
Definition Timespan.h:76
static FTimespan Zero()
Definition Timespan.h:747
Definition MinimalWindowsApi.h:192
Definition MinimalWindowsApi.h:102