UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CocoaThread.cpp File Reference

Classes

class  FCocoaRunLoopSourceInfo
 
class  FCocoaRunLoopTask
 
class  FCocoaRunLoopSource
 

Macros

#define GAME_THREAD_STACK_SIZE   128 * 1024 * 1024
 

Functions

void MainThreadCall (dispatch_block_t Block, bool const bWait, NSString *WaitMode)
 
void GameThreadCall (dispatch_block_t Block, bool const bWait, NSArray *SendModes)
 
void RunGameThread (id Target, SEL Selector)
 
void ProcessGameThreadEvents (void)
 

Variables

NSStringUnrealNilEventMode = @"@"UnrealNilEventMode"
 
NSStringUnrealShowEventMode = @"@"UnrealShowEventMode"
 
NSStringUnrealResizeEventMode = @"@"UnrealResizeEventMode"
 
NSStringUnrealFullscreenEventMode = @"@"UnrealFullscreenEventMode"
 
NSStringUnrealCloseEventMode = @"@"UnrealCloseEventMode"
 
NSStringUnrealIMEEventMode = @"@"UnrealIMEEventMode"
 
uint32 GMacMainThreadId = 0
 
 __pad0__
 
return Self
 
thread_local NSStringGThreadInstigatorWaitMode = nullptr
 

Macro Definition Documentation

◆ GAME_THREAD_STACK_SIZE

#define GAME_THREAD_STACK_SIZE   128 * 1024 * 1024

Function Documentation

◆ GameThreadCall()

void GameThreadCall ( dispatch_block_t  Block,
bool const  bWait = true,
NSArray SendModes = @[NSDefaultRunLoopMode] 
)

Schedule a block to be executed on GameThread

Parameters
Block- The block to execute on GameThread, example: ^{ UE_LOG(LogMac, Log, TEXT("Hello GameThread"); }
bWait- Wether or not to wait until the block is executed.
SendModes- The modes for the block we are scheduling, this is use to specify who can execute the scheduled block.

Be careful to make sure that GameThread will be processing at least one of the modes or you could end up causing a deadlock by preventing further progress.

◆ MainThreadCall()

void MainThreadCall ( dispatch_block_t  Block,
bool const  bWait = true,
NSString WaitMode = NSDefaultRunLoopMode 
)

Schedule a block to be executed on MainThread.

Parameters
Block- The block to execute on MainThread, example: ^{ UE_LOG(LogMac, Log, TEXT("Hello MainThread"); }
bWait- Wether or not to wait until the block is executed.
WaitMode- The mode we are allowed to execute while waiting. (Only use when bWait = true)

Avoid being too restrictive on the WaitMode or you could cause a deadlock by preventing further progress.

◆ ProcessGameThreadEvents()

void ProcessGameThreadEvents ( void  )

◆ RunGameThread()

void RunGameThread ( id  Target,
SEL  Selector 
)

Variable Documentation

◆ __pad0__

__pad0__

◆ GMacMainThreadId

uint32 GMacMainThreadId = 0

Thread ID of the Mac MainThread

◆ GThreadInstigatorWaitMode

thread_local NSString* GThreadInstigatorWaitMode = nullptr

◆ Self

return Self

◆ UnrealCloseEventMode

NSString* UnrealCloseEventMode = @"@"UnrealCloseEventMode"

◆ UnrealFullscreenEventMode

NSString* UnrealFullscreenEventMode = @"@"UnrealFullscreenEventMode"

◆ UnrealIMEEventMode

NSString* UnrealIMEEventMode = @"@"UnrealIMEEventMode"

◆ UnrealNilEventMode

NSString* UnrealNilEventMode = @"@"UnrealNilEventMode"

◆ UnrealResizeEventMode

NSString* UnrealResizeEventMode = @"@"UnrealResizeEventMode"

◆ UnrealShowEventMode

NSString* UnrealShowEventMode = @"@"UnrealShowEventMode"