MCRO
C++23 utilities for Unreal Engine.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
Threading.h File Reference
#include "CoreMinimal.h"
#include "Mcro/FunctionTraits.h"
#include "Mcro/SharedObjects.h"

Go to the source code of this file.

Namespaces

namespace  Mcro
 
namespace  Mcro::Threading
 
namespace  Mcro::Threading::Detail
 

Functions

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.
 
MCRO_API auto Mcro::Threading::Detail::GetThreadCheck (ENamedThreads::Type threadName) -> bool(*)()
 
template<CFunctionLike When>
requires (TFunction_ArgCount<When> == 0)
void Mcro::Threading::Detail::RunInThreadBoilerplate (ENamedThreads::Type threadName, TUniqueFunction< void()> &&func, When &&when)
 
template<CFunctionLike When>
requires (TFunction_ArgCount<When> == 0)
void Mcro::Threading::Detail::EnqueueRenderCommandBoilerplate (TUniqueFunction< void(FRHICommandListImmediate &)> &&func, When &&when)
 
template<CFunctorObject Function, typename Result = TFunction_Return<Function>, CFunctionLike When>
requires ( TFunction_ArgCount<Function> == 0 && TFunction_ArgCount<When> == 0 )
TFuture< Result > Mcro::Threading::Detail::PromiseInThreadBoilerplate (ENamedThreads::Type threadName, Function &&func, When &&when)
 
template<CFunctorObject Function, typename Result = TFunction_Return<Function>, CFunctionLike When>
requires ( TFunction_ArgCount<Function> == 1 && CSameAs<FRHICommandListImmediate&, TFunction_Arg<Function, 0>> && TFunction_ArgCount<When> == 0 )
TFuture< Result > Mcro::Threading::Detail::EnqueueRenderPromiseBoilerplate (ENamedThreads::Type threadName, Function &&func, When &&when)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Detailed Description

Author
David Mórász
Date
2025

Definition in file Threading.h.