UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UnixPlatformRunnableThread.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================================
4 UnixRunnableThread.h: Unix platform threading functions
5==============================================================================================*/
6
7#pragma once
8
9#include "CoreTypes.h"
11#include <signal.h> // for SIGSTKSZ
12
13class Error;
14
18class FRunnableThreadUnix : public FRunnableThreadPThread
19{
20 struct EConstants
21 {
22 enum
23 {
24 UnixThreadNameLimit = 15, // the limit for thread name is just 15 chars :( http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
25
26 CrashHandlerStackSize = SIGSTKSZ + 192 * 1024, // should be at least SIGSTKSIZE, plus 192K because we do logging and symbolication in crash handler
27 CrashHandlerStackSizeMin = SIGSTKSZ + 8 * 1024 // minimum allowed stack size
28 };
29 };
30
32 void* ThreadCrashHandlingStack;
33
35 void* StackGuardPageAddress;
36
38 int BaselineNiceValue;
39
41 bool bGotBaselineNiceValue;
42
43public:
44
47
48 static void *AllocCrashHandlerStack();
49 static void FreeCrashHandlerStack(void *StackBuffer);
51
53 : FRunnableThreadPThread()
54 , ThreadCrashHandlingStack(nullptr)
55 , StackGuardPageAddress(nullptr)
56 , BaselineNiceValue(0)
57 , bGotBaselineNiceValue(false)
58 {
59 }
60
62 {
63 // Call the parent destructor body before the parent does it - see comment on that function for explanation why.
65 }
66
79 static bool SetupSignalHandlerStack(void* StackBuffer, const size_t StackBufferSize, void** OutStackGuardPageAddress);
80
81protected:
82
85
87
89
90private:
91
95 void PreRun() override;
96
97 void PostRun() override;
98
102 uint32 AdjustStackSize(uint32 InStackSize) override;
103};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EThreadPriority
Definition GenericPlatformAffinity.h:26
EConstants
Definition WindowsPlatformCrashContext.cpp:100
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition UnixPlatformRunnableThread.h:19
~FRunnableThreadUnix()
Definition UnixPlatformRunnableThread.h:61
static void * MainThreadSignalHandlerStack
Definition UnixPlatformRunnableThread.h:46
static void * AllocCrashHandlerStack()
Definition UnixPlatformCrashContext.cpp:1067
static void FreeCrashHandlerStack(void *StackBuffer)
Definition UnixPlatformCrashContext.cpp:1082
int32 TranslateThreadPriority(EThreadPriority Priority) override
Definition UnixPlatformRunnableThread.cpp:74
FRunnableThreadUnix()
Definition UnixPlatformRunnableThread.h:52
void SetThreadPriority(EThreadPriority NewPriority) override
Definition UnixPlatformRunnableThread.cpp:79
static uint64 GetCrashHandlerStackSize()
Definition UnixPlatformCrashContext.cpp:1103
static bool SetupSignalHandlerStack(void *StackBuffer, const size_t StackBufferSize, void **OutStackGuardPageAddress)
Definition UnixPlatformRunnableThread.cpp:14
@ false
Definition radaudio_common.h:23