Navigation
API > API/Runtime > API/Runtime/Chaos
A first-in, first-out "fair" read-write lock around a generic mutex Given a mutex (either just FCriticalSection or some custom lock) this class implements a fair lock. Any number of readers can enter the lock but as soon as a writer attempts to enter the lock all subsequent readers are forced to wait until the current readers leave the lock and the writer gets a chance to perform its operation. Once the write is completed the waiting readers are able to resume. This ensures we do not end up in a situation where we have a write waiting but many reads end up constantly forcing the write to wait. In a physics context a write on the game thread is time-critical and we want that thread to resume as soon as possible by pausing any reads (scene queries) until the write is finished
| Name | TRwFifoLock |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Framework/Threading.h |
| Include Path | #include "Framework/Threading.h" |
Syntax
template<typename MutexType>
class TRwFifoLock
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TRwFifoLock() |
Framework/Threading.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TRwFifoLock() |
Framework/Threading.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Mutex | MutexType | Framework/Threading.h | ||
| NumReaders | std::atomic< uint32 > | Framework/Threading.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ReadLock() |
Framework/Threading.h | ||
void ReadUnlock() |
Framework/Threading.h | ||
void WriteLock() |
Framework/Threading.h | ||
void WriteUnlock() |
Framework/Threading.h |