October3d55/M/UltraleapTracking/Source/UltraleapTrackingCore/Private/LeapAsync.cpp

28 lines
1.1 KiB
C++

/******************************************************************************
* Copyright (C) Ultraleap, Inc. 2011-2021. *
* *
* Use subject to the terms of the Apache License 2.0 available at *
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
* between Ultraleap and you, your company or other organization. *
******************************************************************************/
#pragma once
#include "LeapAsync.h"
#include "Async/Async.h"
TFuture<void> FLeapAsync::RunLambdaOnBackGroundThread(TFunction<void()> InFunction)
{
return Async(EAsyncExecution::Thread, InFunction);
}
TFuture<void> FLeapAsync::RunLambdaOnBackGroundThreadPool(TFunction<void()> InFunction)
{
return Async(EAsyncExecution::ThreadPool, InFunction);
}
FGraphEventRef FLeapAsync::RunShortLambdaOnGameThread(TFunction<void()> InFunction)
{
return FFunctionGraphTask::CreateAndDispatchWhenReady(InFunction, TStatId(), nullptr, ENamedThreads::GameThread);
}