UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CocoaThread.h File Reference
#include "CoreMinimal.h"

Go to the source code of this file.

Classes

category  NSThread(FCocoaThread)
 
class  FCocoaGameThread
 

Macros

#define MAC_SEPARATE_GAME_THREAD   1
 

Functions

CORE_API void MainThreadCall (dispatch_block_t Block, bool const bWait=true, NSString *WaitMode=NSDefaultRunLoopMode)
 
CORE_API void MainThreadCall (dispatch_block_t Block, NSString *WaitMode, bool const bWait=true)
 
template<typename ReturnType >
ReturnType MainThreadReturn (ReturnType(^Block)(void), NSString *WaitMode=NSDefaultRunLoopMode)
 
CORE_API void GameThreadCall (dispatch_block_t Block, bool const bWait=true, NSArray *SendModes=@[NSDefaultRunLoopMode])
 
CORE_API void GameThreadCall (dispatch_block_t Block, NSArray *SendModes, bool const bWait=true)
 
template<typename ReturnType >
ReturnType GameThreadReturn (ReturnType(^Block)(void), NSArray *SendModes=@[NSDefaultRunLoopMode])
 
CORE_API void RunGameThread (id Target, SEL Selector)
 
CORE_API void ProcessGameThreadEvents (void)
 

Variables

CORE_API NSStringUnrealNilEventMode
 
CORE_API NSStringUnrealShowEventMode
 
CORE_API NSStringUnrealResizeEventMode
 
CORE_API NSStringUnrealFullscreenEventMode
 
CORE_API NSStringUnrealCloseEventMode
 
CORE_API NSStringUnrealIMEEventMode
 
CORE_API uint32 GMacMainThreadId
 

Macro Definition Documentation

◆ MAC_SEPARATE_GAME_THREAD

#define MAC_SEPARATE_GAME_THREAD   1

Function Documentation

◆ GameThreadCall() [1/2]

CORE_API 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.

◆ GameThreadCall() [2/2]

CORE_API void GameThreadCall ( dispatch_block_t  Block,
NSArray SendModes,
bool const  bWait = true 
)
inline

◆ GameThreadReturn()

template<typename ReturnType >
ReturnType GameThreadReturn ( ReturnType(^)(void Block,
NSArray SendModes = @[ NSDefaultRunLoopMode ] 
)

Schedule a block to be executed on GameThread with a return value.

Parameters
Block- The block to execute on GameThread, example: ^{ return 5; }
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() [1/2]

CORE_API 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.

◆ MainThreadCall() [2/2]

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

◆ MainThreadReturn()

template<typename ReturnType >
ReturnType MainThreadReturn ( ReturnType(^)(void Block,
NSString WaitMode = NSDefaultRunLoopMode 
)

Schedule a block to be executed on MainThread with a return value.

Parameters
Block- The block to execute on MainThread, example: ^{ return 5; }
WaitMode- The mode we are allowed to execute while waiting.

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

◆ ProcessGameThreadEvents()

CORE_API void ProcessGameThreadEvents ( void  )

◆ RunGameThread()

CORE_API void RunGameThread ( id  Target,
SEL  Selector 
)

Variable Documentation

◆ GMacMainThreadId

CORE_API uint32 GMacMainThreadId
extern

Thread ID of the Mac MainThread

◆ UnrealCloseEventMode

CORE_API NSString* UnrealCloseEventMode
extern

◆ UnrealFullscreenEventMode

CORE_API NSString* UnrealFullscreenEventMode
extern

◆ UnrealIMEEventMode

CORE_API NSString* UnrealIMEEventMode
extern

◆ UnrealNilEventMode

CORE_API NSString* UnrealNilEventMode
extern

◆ UnrealResizeEventMode

CORE_API NSString* UnrealResizeEventMode
extern

◆ UnrealShowEventMode

CORE_API NSString* UnrealShowEventMode
extern