Navigation
API > API/Runtime > API/Runtime/Core
This a special version of singleton. It means that there is created only one instance for each thread. Calling Get() method is thread-safe.
| Name | TThreadSingleton |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/HAL/ThreadSingleton.h |
| Include Path | #include "HAL/ThreadSingleton.h" |
Syntax
template<class T>
class TThreadSingleton : public FTlsAutoCleanup
Inheritance Hierarchy
- FTlsAutoCleanup → TThreadSingleton
Derived Classes
TThreadSingleton derived class hierarchy
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TThreadSingleton() |
Default constructor. | HAL/ThreadSingleton.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~TThreadSingleton() |
HAL/ThreadSingleton.h |
Functions
Protected
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FTlsAutoCleanup * CreateInstance() |
HAL/ThreadSingleton.h | ||
static T & Get () |
HAL/ThreadSingleton.h | ||
static T & Get
(
TFunctionRef< FTlsAutoCleanup*()> CreateInstance |
HAL/ThreadSingleton.h | ||
static uint32 & GetTlsSlot () |
HAL/ThreadSingleton.h | ||
static T * Inject
(
T* Instance |
HAL/ThreadSingleton.h | ||
static T * TryGet() |
HAL/ThreadSingleton.h |