Navigation
API > API/Runtime > API/Runtime/Chaos
Lockable resource for use with chaos data. External threads should call GetRead and ReleaseRead on this object to lock it for read. When this is done the physics thread will not be allowed to swap the buffers so external reads are safe. Physics code can use GetWritable to get access to the write buffer, no locks are performed here as the lock is only required from the physics side when swapping the buffers. No external thread should ever attempt to swap the buffer. Only the owning thread
| Name | TChaosReadWriteResource |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Framework/BufferedData.h |
| Include Path | #include "Chaos/Framework/BufferedData.h" |
Syntax
template<typename ResourceType>
class TChaosReadWriteResource
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TChaosReadWriteResource
(
EInPlace, |
Chaos/Framework/BufferedData.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Buffer | ResourceType | Storage for the buffered objects | Chaos/Framework/BufferedData.h | |
| ReadIndex | int32 | Index into the buffer for which side is the external side | Chaos/Framework/BufferedData.h | |
| ResourceLock | FRWLock | Mutable lock so a const resource can be read locked, keeps this object logically if not literally const | Chaos/Framework/BufferedData.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const ResourceType & GetRead() |
Gets the readable version of the resource | Chaos/Framework/BufferedData.h | |
const ResourceType & GetReadable() |
Gets the owning thread's const readable side of the buffer | Chaos/Framework/BufferedData.h | |
ResourceType & GetWritable() |
Gets the owning thread's writable side of the buffer | Chaos/Framework/BufferedData.h | |
void ReleaseRead() |
Release read locks | Chaos/Framework/BufferedData.h | |
void Swap() |
Swaps the read/write sides of the buffer safely so no readers are interrupted (grabs a write lock) | Chaos/Framework/BufferedData.h |