Navigation
API > API/Runtime > API/Runtime/Core
A transactionally safe access detector that works in the following novel ways:
- In the open (non-transactional):
- Acquires the read/write access like before.
- Release the read/write access like before.
- In the closed (transactional):
- During acquiring read access we query `ReadLockCount_:
- 0 means we haven't taken read access before in our transaction nest and we acquire it.
- But only if we haven't previously taken write access (by querying `WriteLockCount_).
- Then we bump `ReadLockCount_ to remember we did a read.
- We also register an on-abort handler to release the access.
- During acquiring write access we query `WriteLockCount_:
- 0 means we haven't taken write access before in our transaction nest and we acquire it.
- But if `ReadLockCount_ was non-zero then we have to upgrade the access from read to write.
- Then we bump `WriteLockCount_ to remember we did a write.
- During releases we defer these to on-commit.
During on-commit we always release all our `ReadLockCount_'s first, so that we handle the case correctly where we had read then write, we need to only actually release the write access and this means we correctly handle that case.
| Name | FRWTransactionallySafeAccessDetectorDefinition |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/MTTransactionallySafeAccessDetector.h |
| Include Path | #include "Misc/MTTransactionallySafeAccessDetector.h" |
Syntax
struct FRWTransactionallySafeAccessDetectorDefinition
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FRWTransactionallySafeAccessDetectorDefinition() |
Misc/MTTransactionallySafeAccessDetector.h |
Structs
| Name | Remarks |
|---|---|
| FState |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| State | TSharedPtr< FState > | The state held for calls made when in a transaction. | Misc/MTTransactionallySafeAccessDetector.h | |
| TScopedReaderAccessDetector< const FRWTransactionallySafeAccessDetectorDefinition > | friend | Misc/MTTransactionallySafeAccessDetector.h | ||
| TScopedReaderAccessDetector< FRWTransactionallySafeAccessDetectorDefinition > | friend | Misc/MTTransactionallySafeAccessDetector.h | ||
| TScopedWriterDetector< const FRWTransactionallySafeAccessDetectorDefinition > | friend | Misc/MTTransactionallySafeAccessDetector.h | ||
| TScopedWriterDetector< FRWTransactionallySafeAccessDetectorDefinition > | friend | Misc/MTTransactionallySafeAccessDetector.h |
Functions
Public
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static UE_AUTORTFM_NOAUTORTFM void ReleaseAccess
(
TSharedPtr< FState > State |
Misc/MTTransactionallySafeAccessDetector.h |