Navigation
API > API/Runtime > API/Runtime/Core
A read-write lock that doesn't put the thread into a WAIT state but instead repeatedly tries to acquire the lock. WARNING: Should be used only for very short locks. Use with [TRWScopeLock](API\Runtime\Core\TRWScopeLock)_, TWriteScopeLock or `TReadScopeLock. The SizeType template type dictates the space taken by the spinlock but also its maximum number of possible concurrent readers (i.e. 254 for uint8, etc...). Read locks support recursion. Write locks don't support recursion even if coming from the same thread currently owning the write lock.
| Name | TRWSpinLock |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/RWSpinLock.h |
| Include Path | #include "Misc/RWSpinLock.h" |
Syntax
template<typename SizeType>
class TRWSpinLock
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TRWSpinLock () |
Misc/RWSpinLock.h | ||
TRWSpinLock
(
TRWSpinLock&& |
Misc/RWSpinLock.h | ||
TRWSpinLock
(
const TRWSpinLock& |
Misc/RWSpinLock.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Lock | std::atomic< SizeType > | Misc/RWSpinLock.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ReadLock() |
Misc/RWSpinLock.h | ||
void ReadUnlock() |
Misc/RWSpinLock.h | ||
bool TryReadLock() |
Misc/RWSpinLock.h | ||
bool TryWriteLock() |
Misc/RWSpinLock.h | ||
void WriteLock() |
Misc/RWSpinLock.h | ||
void WriteUnlock() |
Misc/RWSpinLock.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TRWSpinLock & operator=
(
const TRWSpinLock& |
Misc/RWSpinLock.h | ||
TRWSpinLock & operator=
(
TRWSpinLock&& |
Misc/RWSpinLock.h |