Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TlsAutoCleanup.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6
7/**
8Base class for objects in TLS that support auto-cleanup.
9Polymorphically deletes registered instances on thread exit.
10*/
12{
13public:
14 /** Virtual destructor. */
15 virtual ~FTlsAutoCleanup()
16 {}
17
18 /** Register this instance to be auto-cleanup. */
19 void Register();
20};
21
22/** Wrapper for values to be stored in TLS that support auto-cleanup. */
23template< class T >
25 : public FTlsAutoCleanup
26{
27public:
28
29 /** Constructor. */
30 TTlsAutoCleanupValue(const T& InValue)
31 : Value(InValue)
32 { }
33
34 /** Gets the value. */
35 T Get() const
36 {
37 return Value;
38 }
39
40 /* Sets the value. */
41 void Set(const T& InValue)
42 {
43 Value = InValue;
44 }
45
46 /* Sets the value. */
47 void Set(T&& InValue)
48 {
50 }
51
52private:
53
54 /** The value. */
56};
virtual ~FTlsAutoCleanup()
void Set(const T &InValue)
TTlsAutoCleanupValue(const T &InValue)
void Set(T &&InValue)