33 return !!(State.load(std::memory_order_relaxed) & IsLockedFlag);
38 uint8 Expected = State.load(std::memory_order_relaxed);
39 return !(Expected & IsLockedFlag) &&
40 State.compare_exchange_strong(Expected, Expected | IsLockedFlag, std::memory_order_acquire, std::memory_order_relaxed);
46 if (
LIKELY(State.compare_exchange_weak(Expected, IsLockedFlag, std::memory_order_acquire, std::memory_order_relaxed)))
56 const uint8 LastState = State.fetch_sub(IsLockedFlag, std::memory_order_release);
66 UE_API void WakeWaitingThread();
70 static constexpr uint8 IsLockedFlag = 1 << 0;
71 static constexpr uint8 MayHaveWaitingLockFlag = 1 << 1;
73 std::atomic<uint8> State = 0;
#define LIKELY(x)
Definition CityHash.cpp:107
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_API
Definition SColorGradingComponentViewer.h:12
FMutex(FAcquireLock)
Definition Mutex.h:23
bool IsLocked() const
Definition Mutex.h:31
void Lock()
Definition Mutex.h:43
FMutex & operator=(const FMutex &)=delete
void Unlock()
Definition Mutex.h:53
constexpr FMutex()=default
bool TryLock()
Definition Mutex.h:36
FMutex(const FMutex &)=delete
Definition AdvancedWidgetsModule.cpp:13