UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ApplePlatformTLS.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
/*=============================================================================================
4
ApplePlatformTLS.h: Apple platform TLS (Thread local storage and thread ID) functions
5
==============================================================================================*/
6
7
#pragma once
8
#include "
GenericPlatform/GenericPlatformTLS.h
"
9
#include "
CoreTypes.h
"
10
#if PLATFORM_MAC
11
#include "
Mac/MacSystemIncludes.h
"
12
#elif PLATFORM_IOS
13
#include "
IOS/IOSSystemIncludes.h
"
14
#endif
15
19
struct
CORE_API
FApplePlatformTLS
:
public
FGenericPlatformTLS
20
{
24
static
UE_FORCEINLINE_HINT
uint32
GetCurrentThreadId
(
void
)
25
{
26
return
(
uint32
)
pthread_mach_thread_np
(
pthread_self
());
27
}
28
32
static
inline
uint32
AllocTlsSlot
(
void
)
33
{
34
// allocate a per-thread mem slot
35
pthread_key_t
SlotKey
= 0;
36
if
(
pthread_key_create
(&
SlotKey
,
NULL
) != 0)
37
{
38
SlotKey
=
InvalidTlsSlot
;
// matches the Windows TlsAlloc() retval.
39
}
40
return
SlotKey
;
41
}
42
49
static
UE_FORCEINLINE_HINT
void
SetTlsValue
(
uint32
SlotIndex,
void
*
Value
)
50
{
51
pthread_setspecific
((
pthread_key_t
)SlotIndex,
Value
);
52
}
53
59
static
UE_FORCEINLINE_HINT
void
*
GetTlsValue
(
uint32
SlotIndex)
60
{
61
return
pthread_getspecific
((
pthread_key_t
)SlotIndex);
62
}
63
69
static
UE_FORCEINLINE_HINT
void
FreeTlsSlot
(
uint32
SlotIndex)
70
{
71
pthread_key_delete
((
pthread_key_t
)SlotIndex);
72
}
73
};
74
75
typedef
FApplePlatformTLS
FPlatformTLS
;
NULL
#define NULL
Definition
oodle2base.h:134
FPlatformTLS
FApplePlatformTLS FPlatformTLS
Definition
ApplePlatformTLS.h:75
CoreTypes.h
UE_FORCEINLINE_HINT
#define UE_FORCEINLINE_HINT
Definition
Platform.h:723
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
GenericPlatformTLS.h
IOSSystemIncludes.h
MacSystemIncludes.h
EColorPickerChannels::Value
@ Value
uint32
uint32_t uint32
Definition
binka_ue_file_header.h:6
FApplePlatformTLS
Definition
ApplePlatformTLS.h:20
FApplePlatformTLS::SetTlsValue
static UE_FORCEINLINE_HINT void SetTlsValue(uint32 SlotIndex, void *Value)
Definition
ApplePlatformTLS.h:49
FApplePlatformTLS::AllocTlsSlot
static uint32 AllocTlsSlot(void)
Definition
ApplePlatformTLS.h:32
FApplePlatformTLS::GetTlsValue
static UE_FORCEINLINE_HINT void * GetTlsValue(uint32 SlotIndex)
Definition
ApplePlatformTLS.h:59
FApplePlatformTLS::GetCurrentThreadId
static UE_FORCEINLINE_HINT uint32 GetCurrentThreadId(void)
Definition
ApplePlatformTLS.h:24
FApplePlatformTLS::FreeTlsSlot
static UE_FORCEINLINE_HINT void FreeTlsSlot(uint32 SlotIndex)
Definition
ApplePlatformTLS.h:69
FGenericPlatformTLS
Definition
GenericPlatformTLS.h:12
FGenericPlatformTLS::InvalidTlsSlot
static const uint32 InvalidTlsSlot
Definition
GenericPlatformTLS.h:13
Engine
Source
Runtime
Core
Public
Apple
ApplePlatformTLS.h
Generated by
1.9.8