UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ApplePlatformRunnableThread.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================================
4 ApplePlatformRunnableThread.h: Apple platform threading functions
5==============================================================================================*/
6
7#pragma once
8
10
14class FRunnableThreadApple : public FRunnableThreadPThread
15{
16public:
18 : Pool(NULL)
19 {
20 }
21
23 {
24 // Call the parent destructor body before the parent does it - see comment on that function for explanation why.
26 }
27
28private:
32 virtual void PreRun() override
33 {
34 //@todo - zombie - This and the following build somehow. It makes no sense to me. -astarkey
35 Pool = FPlatformMisc::CreateAutoreleasePool();
37 }
38
42 virtual void PostRun() override
43 {
44 FPlatformMisc::ReleaseAutoreleasePool(Pool);
45 }
46
47 virtual int GetDefaultStackSize() override
48 {
49 // default is 512 KB, we need more
50 return FPlatformMisc::GetDefaultStackSize();
51 }
52
56 virtual uint32 AdjustStackSize(uint32 InStackSize) override
57 {
58 InStackSize = FRunnableThreadPThread::AdjustStackSize(InStackSize);
59
60 // If it's set, make sure it's at least 128 KB or stack allocations (e.g. in Logf) may fail
61 if (InStackSize < GetDefaultStackSize())
62 {
63 InStackSize = GetDefaultStackSize();
64 }
65
66 return InStackSize;
67 }
68
73 virtual int32 TranslateThreadPriority(EThreadPriority Priority) override
74 {
75 // these are some default priorities
76 switch (Priority)
77 {
78 // 0 is the lowest, 47 is the high priority for Apple
79 case TPri_TimeCritical: return 47;
80 case TPri_Highest: return 45;
81 case TPri_AboveNormal: return 37;
82 case TPri_Normal: return 31;
83 case TPri_SlightlyBelowNormal: return 30;
84 case TPri_BelowNormal: return 25;
85 case TPri_Lowest: return 20;
86 case TPri_Num:
87 default: UE_LOG(LogHAL, Fatal, TEXT("Unknown Priority passed to FRunnableThreadApple::TranslateThreadPriority()")); return 31;
88 }
89 }
90
91 void* Pool;
92};
93
#define NULL
Definition oodle2base.h:134
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EThreadPriority
Definition GenericPlatformAffinity.h:26
@ TPri_TimeCritical
Definition GenericPlatformAffinity.h:33
@ TPri_AboveNormal
Definition GenericPlatformAffinity.h:28
@ TPri_Lowest
Definition GenericPlatformAffinity.h:31
@ TPri_SlightlyBelowNormal
Definition GenericPlatformAffinity.h:32
@ TPri_Highest
Definition GenericPlatformAffinity.h:30
@ TPri_BelowNormal
Definition GenericPlatformAffinity.h:29
@ TPri_Num
Definition GenericPlatformAffinity.h:34
@ TPri_Normal
Definition GenericPlatformAffinity.h:27
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
#define TCHAR_TO_ANSI(str)
Definition StringConv.h:1019
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ApplePlatformRunnableThread.h:15
~FRunnableThreadApple()
Definition ApplePlatformRunnableThread.h:22
FRunnableThreadApple()
Definition ApplePlatformRunnableThread.h:17