MCRO
C++23 utilities for Unreal Engine.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
Mcro::Threading Namespace Reference

Namespaces

namespace  Detail
 

Functions

MCRO_API bool IsInThread (ENamedThreads::Type threadName)
 Returns true when called in the thread which is associated with the given ENamedThreads. If there's no such a thread or if this function is not called in that thread, return false.
 
MCRO_API void RunInThread (ENamedThreads::Type threadName, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already.
 
MCRO_API void RunInThread (ENamedThreads::Type threadName, const UObject *boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already check the validity of a target object first before running on the selected thread.
 
MCRO_API void RunInThread (ENamedThreads::Type threadName, const FWeakObjectPtr &boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already check the validity of a target object first before running on the selected thread.
 
MCRO_API void RunInGameThread (TUniqueFunction< void()> &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already.
 
MCRO_API void RunInGameThread (const UObject *boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
MCRO_API void RunInGameThread (const FWeakObjectPtr &boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
MCRO_API void EnqueueRenderCommand (TUniqueFunction< void(FRHICommandListImmediate &)> &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already.
 
MCRO_API void EnqueueRenderCommand (const UObject *boundToObject, TUniqueFunction< void(FRHICommandListImmediate &)> &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.
 
MCRO_API void EnqueueRenderCommand (const FWeakObjectPtr &boundToObject, TUniqueFunction< void(FRHICommandListImmediate &)> &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.
 
template<CSharedOrWeak Object>
void RunInThread (ENamedThreads::Type threadName, const Object &boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.
 
template<CSharedOrWeak Object>
void RunInGameThread (const Object &boundToObject, TUniqueFunction< void()> &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
template<CSharedOrWeak Object>
void EnqueueRenderCommand (const Object &boundToObject, TUniqueFunction< void(FRHICommandListImmediate &)> &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInThread (ENamedThreads::Type threadName, Function &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already This overload doesn't check object lifespans.
 
template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInThread (ENamedThreads::Type threadName, const Object &boundToObject, Function &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.
 
template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInThread (ENamedThreads::Type threadName, const Object *boundToObject, Function &&func)
 Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.
 
template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInGameThread (Function &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already This overload doesn't check object lifespans.
 
template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInGameThread (const Object &boundToObject, Function &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > PromiseInGameThread (const Object *boundToObject, Function &&func)
 Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.
 
template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > EnqueueRenderPromise (Function &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already This overload doesn't check object lifespans.
 
template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > EnqueueRenderPromise (const Object &boundToObject, Function &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.
 
template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > EnqueueRenderPromise (const Object *boundToObject, Function &&func)
 Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.
 

Function Documentation

◆ EnqueueRenderCommand() [1/4]

MCRO_API void Mcro::Threading::EnqueueRenderCommand ( const FWeakObjectPtr & boundToObject,
TUniqueFunction< void(FRHICommandListImmediate &)> && func )

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.

◆ EnqueueRenderCommand() [2/4]

template<CSharedOrWeak Object>
void Mcro::Threading::EnqueueRenderCommand ( const Object & boundToObject,
TUniqueFunction< void(FRHICommandListImmediate &)> && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

Definition at line 205 of file Threading.h.

◆ EnqueueRenderCommand() [3/4]

MCRO_API void Mcro::Threading::EnqueueRenderCommand ( const UObject * boundToObject,
TUniqueFunction< void(FRHICommandListImmediate &)> && func )

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.

◆ EnqueueRenderCommand() [4/4]

MCRO_API void Mcro::Threading::EnqueueRenderCommand ( TUniqueFunction< void(FRHICommandListImmediate &)> && func)

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already.

◆ EnqueueRenderPromise() [1/3]

template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > Mcro::Threading::EnqueueRenderPromise ( const Object & boundToObject,
Function && func )

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.

Definition at line 354 of file Threading.h.

◆ EnqueueRenderPromise() [2/3]

template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > Mcro::Threading::EnqueueRenderPromise ( const Object * boundToObject,
Function && func )

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already Check the validity of a target object first before running on the render thread.

Definition at line 377 of file Threading.h.

◆ EnqueueRenderPromise() [3/3]

template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> )
TFuture< Result > Mcro::Threading::EnqueueRenderPromise ( Function && func)

Simply run a lambda function on the render thread but only use AsyncTask if it's not on the render thread already This overload doesn't check object lifespans.

Definition at line 335 of file Threading.h.

◆ IsInThread()

MCRO_API bool Mcro::Threading::IsInThread ( ENamedThreads::Type threadName)

Returns true when called in the thread which is associated with the given ENamedThreads. If there's no such a thread or if this function is not called in that thread, return false.

◆ PromiseInGameThread() [1/3]

template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInGameThread ( const Object & boundToObject,
Function && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

Definition at line 294 of file Threading.h.

◆ PromiseInGameThread() [2/3]

template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInGameThread ( const Object * boundToObject,
Function && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

Definition at line 314 of file Threading.h.

◆ PromiseInGameThread() [3/3]

template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInGameThread ( Function && func)

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already This overload doesn't check object lifespans.

Definition at line 278 of file Threading.h.

◆ PromiseInThread() [1/3]

template<CSharedOrWeak Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInThread ( ENamedThreads::Type threadName,
const Object & boundToObject,
Function && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.

Definition at line 240 of file Threading.h.

◆ PromiseInThread() [2/3]

template<CUObject Object, CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInThread ( ENamedThreads::Type threadName,
const Object * boundToObject,
Function && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.

Definition at line 260 of file Threading.h.

◆ PromiseInThread() [3/3]

template<CFunctorObject Function, typename Result = TFunction_Return<Function>>
requires (TFunction_ArgCount<Function> == 0)
TFuture< Result > Mcro::Threading::PromiseInThread ( ENamedThreads::Type threadName,
Function && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already This overload doesn't check object lifespans.

Definition at line 224 of file Threading.h.

◆ RunInGameThread() [1/4]

MCRO_API void Mcro::Threading::RunInGameThread ( const FWeakObjectPtr & boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

◆ RunInGameThread() [2/4]

template<CSharedOrWeak Object>
void Mcro::Threading::RunInGameThread ( const Object & boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

Definition at line 194 of file Threading.h.

◆ RunInGameThread() [3/4]

MCRO_API void Mcro::Threading::RunInGameThread ( const UObject * boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already Check the validity of a target object first before running on the game thread.

◆ RunInGameThread() [4/4]

MCRO_API void Mcro::Threading::RunInGameThread ( TUniqueFunction< void()> && func)

Simply run a lambda function on the game thread but only use AsyncTask if it's not on the game thread already.

◆ RunInThread() [1/4]

MCRO_API void Mcro::Threading::RunInThread ( ENamedThreads::Type threadName,
const FWeakObjectPtr & boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already check the validity of a target object first before running on the selected thread.

◆ RunInThread() [2/4]

template<CSharedOrWeak Object>
void Mcro::Threading::RunInThread ( ENamedThreads::Type threadName,
const Object & boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already Check the validity of a target object first before running on the selected thread.

Definition at line 179 of file Threading.h.

◆ RunInThread() [3/4]

MCRO_API void Mcro::Threading::RunInThread ( ENamedThreads::Type threadName,
const UObject * boundToObject,
TUniqueFunction< void()> && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already check the validity of a target object first before running on the selected thread.

◆ RunInThread() [4/4]

MCRO_API void Mcro::Threading::RunInThread ( ENamedThreads::Type threadName,
TUniqueFunction< void()> && func )

Simply run a lambda function on the selected thread but only use AsyncTask if it's not on the selected thread already.